Finding n | Function to generate a fixed number ; Driver Method
< ? php function magicOfSequence ( $ N ) { $ sum = 0 ; for ( $ i = 1 ; $ i <= $ N ; $ i ++ ) $ sum += ( $ i * $ i * $ i + $ i * 2 ) ; return $ sum ; } $ N = 4 ; echo magicOfSequence ( $ N ) ; ? >