PHP program to check if m can be represented as powers of w .
< ? php function asPowerSum ( $ w , $ m ) { while ( $ m ) { if ( ( $ m - 1 ) % $ w == 0 ) $ m = ( $ m - 1 ) / $ w ; else if ( ( $ m + 1 ) % $ w == 0 ) $ m = ( $ m + 1 ) / $ w ; else if ( $ m % $ w == 0 ) $ m = $ m / $ w ; else