# Project Euler #63: Powerful digit counts

# Project Euler #63: Powerful digit counts

AbhiPathania003 + 1 comment first problem where you don't need to apply any logic to speed up your code. :)

RobertsN + 0 comments Kind-of. You just need to think about minimums and maximums.

vikramvarun + 0 comments For custom input, n=19, i am getting an approximate answer only even after converting power (double) to BigInteger. The exponential notation when printed removes some digits from last. Java

SAURAV555 + 0 comments Finally realize , I have to make my own power function

kitchent + 0 comments It's just a implementation which loops from

`1`

to`9`

to check the length of`pow(i, N)`

. Doesn't even need to store or sort the answers. The funny part at the beginning is to observe the growth of the number of digits for different powers, and the rest is trivial. Frankly, the original problem is more interesting, as you can also observe that all except are invalid answers.

ameykpatel + 0 comments Just use basic maths and your code reduces further.

import math n=int(input()) a=(math.ceil(pow(10,1-1/n))) for i in range(a,10): print(pow(i,n))

rssalessio + 0 comments i really think this is the easiest project euler i have been doing so far. Just try for N=1,2,3 and understand what's going on.

stbrumme + 0 comments If you program in C++ then make sure you use unsigned long long. The last test case might fail if define your variables as long long only.

scottgauthreaux + 0 comments At first I built my own

`magnitude`

function to determine the number of digits in a number but I realized that`log10()`

does the job quite well. This problem is as simple as brute forcing the math and keeping a list of n values and their corresponding answers. There are only 47 values but that's all I'll say, otherwise I would ruin this challenge for everyone.

shubham76 + 1 comment Just write your own pow function if you are using python! It did the trick!

scottgauthreaux + 0 comments I didn't need to write any functions in python. Just looped over bases 1-9 and exponents 1-21 which yields all the 47 answers by only looping 189 times. And to even further improve performance, I kept a literal with a dictionary with lists for each N.

bharata1803 + 0 comments Really interesting problem. Although at first time I need to run manually to check the patterns. Anyway, this can be solved without calculating the power at all. My code finishes all of test case with 0s. You just need to know the minimum of X, which if X^n will have number of digits more than n. You just need to calculate between [1..X-1] and calculate based on input n.

Sort 39 Discussions, By:

Please Login in order to post a comment