Skip to content

Commit 5832340

Browse files
authored
Merge pull request TheAlgorithms#295 from bp274/master
Modernize Python 2 code to work for Python 3
2 parents dbfc220 + 3562182 commit 5832340

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Project Euler/Problem 01/sol2.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
raw_input = input # Python 3
1212
n = int(raw_input().strip())
1313
sum = 0
14-
terms = (n-1)/3
15-
sum+= ((terms)*(6+(terms-1)*3))/2 #sum of an A.P.
16-
terms = (n-1)/5
17-
sum+= ((terms)*(10+(terms-1)*5))/2
18-
terms = (n-1)/15
19-
sum-= ((terms)*(30+(terms-1)*15))/2
14+
terms = (n-1)//3
15+
sum+= ((terms)*(6+(terms-1)*3))//2 #sum of an A.P.
16+
terms = (n-1)//5
17+
sum+= ((terms)*(10+(terms-1)*5))//2
18+
terms = (n-1)//15
19+
sum-= ((terms)*(30+(terms-1)*15))//2
2020
print(sum)

0 commit comments

Comments
 (0)