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