We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #48: Self powers
Project Euler #48: Self powers
Sort by
recency
|
66 Discussions
|
Please Login in order to post a comment
def Square_sum(n): MOD = 10**10
if name == 'main':
def Square_sum(n):
if name == 'main':
Python 3 100% 1-liner
The above is not the most computationally efficient.
If you don't count import statements againsed the "1-liner" qualifier, the following is better:
` from functools import reduce
print(reduce(lambda a, b: (a+b) % (10**10), [pow(i, i, 10**10) for i in range(1, int(input())+1)])) `
python3 100%
JAva code
I was pretty much surprised that my solution has been accepted 100 % while it took 3.5 seconds on my (modest though) laptop. I thought the correct solutions should take 2 sec at most.