Created
July 25, 2021 14:24
-
-
Save igorvanloo/a6cbea28065e81591fb83db2666c9ec6 to your computer and use it in GitHub Desktop.
Problem 63
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compute(): | |
count = [] | |
for n in range(1,10): | |
for i in range(1,22): | |
if i == len(str(n**i)): | |
count.append(n**i) | |
return len(count) | |
#Used the following function to find the bounds for n | |
#n = 9 bound is 22 because 9^22 | |
#n = 8 bound is 11 | |
#n = 7 bound is 7 | |
#n = 6 bound is 5 | |
#22 is so small might as well brute force from there | |
def find_bound(x): | |
i = 1 | |
while True: | |
if i > len(str(x**i)): | |
break | |
else: | |
i += 1 | |
return i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment