Function: logint Section: number_theoretical C-Name: logint0 Prototype: lGGD& Help: logint(x,b,{&z}): return the largest integer e so that b^e <= x, where the parameters b > 1 and x > 0 are both integers. If the parameter z is present, set it to b^e. Description: (gen,2):small expi($1) (gen,gen,&int):small logint0($1, $2, &$3) Doc: Return the largest integer $e$ so that $b^e \leq x$, where the parameters $b > 1$ and $x > 0$ are both integers. If the parameter $z$ is present, set it to $b^e$. \bprog ? logint(1000, 2) %1 = 9 ? 2^9 %2 = 512 ? logint(1000, 2, &z) %3 = 9 ? z %4 = 512 @eprog\noindent The number of digits used to write $b$ in base $x$ is \kbd{1 + logint(x,b)}: \bprog ? #digits(1000!, 10) %5 = 2568 ? logint(1000!, 10) %6 = 2567 @eprog\noindent This function may conveniently replace \bprog floor( log(x) / log(b) ) @eprog\noindent which may not give the correct answer since PARI does not guarantee exact rounding.