Project Euler/63
From charlesreid1
Problem Statement
How many n-digit positive integers exist which are also an nth power?
Link: https://projecteuler.net/problem=63
Solution Technique
This one is almost embarrassingly easy...
To check if a number $ a^b $ is $ b $ digits, we can take $ \log_{10}(b) $ and if the value, rounded up, is $ b $, our criteria is met.
For this particular problem, we can stop at $ n=25 $, since ceil(log10(9**25)) = 25
Code
Link: https://charlesreid1.com:3000/cs/euler/src/master/scratch/Round2_050-070/063
Flags