Permalink
Browse files

problem 76

  • Loading branch information...
1 parent 1f8cf5c commit 52e1734e64cb3dd5a4a624e86c484b0908aea348 @tingleshao committed Mar 26, 2013
Showing with 19 additions and 0 deletions.
  1. +19 −0 problem71to80/problem76.py
View
@@ -0,0 +1,19 @@
+# problem 76
+# similar to problem 78
+pn_lst = [1]
+n = 1
+while True:
+ i = 0
+ penta = 1
+ pn_lst.append(0)
+ while penta <= n:
+ sign = -1 if i % 4 > 1 else 1
+ pn_lst[n] += sign * pn_lst[n-penta]
+ #pn_lst[n] %= 1000000
+ i+=1
+ j = i / 2 + 1 if (i%2==0) else -(i/2+1)
+ penta = j * (3 * j -1) /2
+ if n == 101:
+ break
+ n+=1
+print pn_lst[100]

0 comments on commit 52e1734

Please sign in to comment.