<>; for(<>){ ($n,$k)=glob; $a=0; $b=1; $c=0; while($a<$n){ $a+=$b; $b*=$k; ++$c; } print$c-1,$/; }