So I have the generic method set up consisting of:
You don't need recursion. This could be computed using foldLeft:
elements.foldLeft(0) { case (accumulator, item) => ...//calculate here next value from previously calculated //value (accumulator) and current item }