When is a logarithm equal to a whole number?

2.8k Views Asked by At

Are there any conditions a logarithm must meet to be a whole number?

In other words: $x=\log_y(z)$, when will $x$ be a whole number?

2

There are 2 best solutions below

1
On

Let $f(t):=\log_y(t)$ for $t>0$. Then

$f((0, \infty))= \mathbb R$.

Hence for each $x \in \mathbb Z$, there is $z \in (0, \infty)$ with $x=\log_y(z)$

0
On

Your comments make clear that what you want is a method for deciding whether $x=\log_y z$ is a whole number, without calculating the logarithm.

It suffices to decide if $z$ is an integer power of $y$. To learn this:

  • Let $z'=z$, and repeatedly divide $z'$ by $y$ until either:
    • $z'=1$. The answer is yes, $x$ is an integer
    • $z'$ is not an integer. The answer is no, $x$ is not an integer

For example, is $x=\log_8 1521364$ an integer? Divide $1521364$ by $8$ repeatedly: $1521364\div 8= 190170\frac12$ is not an integer, so $x$ is not either.

But $2097152\stackrel{\div 8}{\to} 262144\stackrel{\div 8}{\to} 32768\stackrel{\div 8}{\to} 4096\stackrel{\div 8}{\to} 512\stackrel{\div 8}{\to} 64 \stackrel{\div 8}{\to} 8\stackrel{\div 8}{\to}1$, so $\log_8 2097152$ is an integer.

Alternatively, you can run the algorithm backward, computing $y, y^2, y^3, \dots$ until you find an $i$ for which $y^i≥z$. Then $\log_y z$ is an integer if and only if $y^i=z$. A version of this method that computes $i$ with binary search will be faster if $z$ is very large.