mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Solution to Problem 48
This commit is contained in:
parent
81dc221ee2
commit
46b4e51d6e
21
Project Euler/Problem 48/sol1.py
Normal file
21
Project Euler/Problem 48/sol1.py
Normal file
@ -0,0 +1,21 @@
|
||||
from __future__ import print_function
|
||||
'''
|
||||
Self Powers
|
||||
Problem 48
|
||||
|
||||
The series, 11 + 22 + 33 + ... + 1010 = 10405071317.
|
||||
|
||||
Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000.
|
||||
'''
|
||||
|
||||
try:
|
||||
xrange
|
||||
except NameError:
|
||||
xrange = range
|
||||
|
||||
total = 0
|
||||
for i in xrange(1, 1001):
|
||||
total += i**i
|
||||
|
||||
|
||||
print(str(total)[-10:])
|
Loading…
Reference in New Issue
Block a user