1) { $pow++; $n = (int)($n/2); $bin *= 2; } if ($N === $bin) { echo "$pow\n"; } else if (($N - $bin) % 2 === 1) { echo ($pow + 2) . "\n"; } else { echo ($pow + 1) . "\n"; }