# Given a number of the form $n^m$, can we figure out how many 1s it has?

Suppose you have a number $n^m$. Is there a way to figure out how many 1s it contains "easily"? For large numbers, this probably means you do this without computing the value. What about 2s, or other digits?

Are there specific values of n, m for which you can (e.g. n is prime)?

This question arose when I was working on a recreational maths problem. At one point it was necessary to count how many 1s there are in a large prime power but I could not see how to do this without a calculator.

-
I'm pretty sure there isn't a way. at least not for all numbers. – Carry on Smiling Mar 17 '13 at 1:23
If your $n$ isn't divisible by $10$, I'd try using Euler's theorem for $10^k$ for each $k$th digit. – Alexander Gruber Mar 17 '13 at 4:55
If I were asked to do this, I'd give $\frac{m \times \log n}{10}$, as the answer, and hope that gods of probability are on my side :) – xylon97 Mar 17 '13 at 12:27

To give you some idea of how hard this kind of problem is, $2^{86}=77371252455336267181195264$ is conjectured to be the greatest power of $2$ whose decimal representation has no zeros, but no one knows how to prove this. See this entry at the Online Encyclopedia of Integer Sequences.