-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem_048_02.py
More file actions
42 lines (36 loc) · 921 Bytes
/
Copy pathproblem_048_02.py
File metadata and controls
42 lines (36 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
##The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317.
##Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000.
import numpy as np
import itertools
import math
import time
import eulertools as et
def euler48(end):
suma = 0
for i in range(1,end+1):
suma += i ** i
## tmp_val = 1
#### print("i", i)
##
## for j in range(1,i+1):
#### print("i ", i, "j ", j)
## tmp_val = i * tmp_val
## if len(str(tmp_val)) > 10:
#### break
## tmp_val = int(str(tmp_val)[-11:])
#### print(i,j, tmp_val)
##
##
##
##
## suma += tmp_val
#### print(suma)
## if len(str(suma)) > 12:
## suma = int(str(suma)[-12:])
print(str(suma)[-12:])
def main():
start = time.time()
euler48(1000)
end = time.time()
print(end-start)
main()