Advertisement
danchaofan

Euler #65

Dec 10th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. multiplier, numerators = 2, [2, 3]
  2.  
  3. for a in range(2, 100):
  4.     if (a+1) % 3 == 0:
  5.         numerators.append(numerators[-2] + multiplier*numerators[-1])
  6.         multiplier += 2
  7.     else:
  8.         numerators.append(numerators[-2] + numerators[-1])
  9.  
  10. total = 0
  11. for b in str(numerators[-1]):
  12.     total += int(b)
  13. print(total)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement