This is the recursion example (p.97) used in "Programming Interviews Exposed" by John Mongan, Noah Suojanen, Eric Giguère The book's imperative style C# code (function combine) has been reimplemented in Scala. Function recursionEx is in pure FP way.