fork download
  1. import math,fractions
  2. f=math.factorial
  3.  
  4. def memoize(f):
  5. memo = {}
  6. def helper(x):
  7. if x not in memo:
  8. memo[x] = f(x)
  9. return memo[x]
  10. return helper
  11.  
  12. @memoize
  13. def B(m):
  14. return~-m*m%2or 1+sum(B(k)*f(m)/f(k)/f(m-k)/fractions.Fraction(k+~m)for k in range(m))
  15.  
  16. for m in range(61):
  17. print(B(m))
Success #stdin #stdout 0.19s 9936KB
stdin
Standard input is empty
stdout
1
1/2
1/6
0
-1/30
0
1/42
0
-1/30
0
5/66
0
-691/2730
0
7/6
0
-3617/510
0
43867/798
0
-174611/330
0
854513/138
0
-236364091/2730
0
8553103/6
0
-23749461029/870
0
8615841276005/14322
0
-7709321041217/510
0
2577687858367/6
0
-26315271553053477373/1919190
0
2929993913841559/6
0
-261082718496449122051/13530
0
1520097643918070802691/1806
0
-27833269579301024235023/690
0
596451111593912163277961/282
0
-5609403368997817686249127547/46410
0
495057205241079648212477525/66
0
-801165718135489957347924991853/1590
0
29149963634884862421418123812691/798
0
-2479392929313226753685415739663229/870
0
84483613348880041862046775994036021/354
0
-1215233140483755572040304994079820246041491/56786730