(function(){ window.OpenPopKa = true;}())

Spherical objects, such as cannonballs, can be stacked to form a pyramid with one cannonball at the top, sitting on top of a square composed of four cannonballs, sitting on top of a square composed of nine cannonballs, and so forth. Given the following recursive function signature, write a recursive function that it takes as its argument the height of a pyramid of cannonballs and returns the number of cannonballs it contains.

[editor.getValue()]
if (guess[0] != initEditor) { console.log(guess[0]); window.codeValue = guess[0]; window.progexType= "RecurTutor"; window.summexName = "RecWCannonballPROG"; } else { return ""; }

A cannonball pyramid of zero height has no cannonballs.

Level i has i^2 cannonballs.

Simply add up the number of balls at each level, using recursion.