Number of chocolates left after k iterations | Function to find the chocolates left ; Driver code
function results ( n , k ) { return parseInt ( Math . round ( Math . pow ( n , ( 1.0 / Math . pow ( 2.0 , k ) ) ) ) ) ; } var k = 3 , n = 100000000 ; document . write ( " " + k + " " + results ( n , k ) ) ;