$max ) { while ( ($n*2) <= $max) { $n--; $max--; } } $n *= 2; $hit++; } echo $hit.PHP_EOL;