Project Euler #48: Self powers

  • + 0 comments

    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)])) `