Finding n | Function to generate a fixed number ; Driver Function
function magicOfSequence ( N ) { let sum = 0 ; for ( let i = 1 ; i <= N ; i ++ ) sum += ( i * i * i + i * 2 ) ; return sum ; } let N = 4 ; document . write ( magicOfSequence ( N ) ) ;