Recursively break a number in 3 parts to get maximum sum | Function to find the maximum sum ; base conditions ; recursively break the number and return what maximum you can get ; Driver program to run the case
< ? php function breakSum ( $ n ) { if ( $ n == 0 $ n == 1 ) return $ n ; return max ( ( breakSum ( intval ( $ n / 2 ) ) + breakSum ( intval ( $ n / 3 ) ) + breakSum ( intval ( $ n / 4 ) ) ) , $ n ) ; } $ n = 12 ; echo breakSum ( $ n ) ; ? >