blandin-diaz_compositional_bernoulli_numbers_B_S_1_2.sf 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/ruby
  2. # Daniel "Trizen" Șuteu
  3. # Date: 24 February 2018
  4. # https://github.com/trizen
  5. # A new recurrence for computing Blandin-Diaz compositional Bernoulli numbers (B^S)_1,n.
  6. # Formula:
  7. # a(0) = 1
  8. # a(n) = -(Sum_{k=0..n-1} a(k) * binomial(n + 1, k)^2) / (n+1)^2
  9. # Which gives us the nth Blandin-Diaz compositional Bernoulli number as:
  10. # (B^S)_1,n = a(n) / n!
  11. # See also:
  12. # https://arxiv.org/abs/0708.0809
  13. # OEIS entries:
  14. # https://oeis.org/A133002 (numerators)
  15. # https://oeis.org/A133003 (denominators)
  16. func a((0)) { 1 }
  17. func a(n) is cached {
  18. -sum(^n, {|k| a(k) * binomial(n+1, k)**2 }) / (n+1)**2
  19. }
  20. for n in (0..30) {
  21. printf("(B^S)_1(%2d) = %45s / %s\n", n, a(n) / n! -> nude)
  22. }
  23. __END__
  24. (B^S)_1( 0) = 1 / 1
  25. (B^S)_1( 1) = -1 / 4
  26. (B^S)_1( 2) = 5 / 72
  27. (B^S)_1( 3) = -1 / 48
  28. (B^S)_1( 4) = 139 / 21600
  29. (B^S)_1( 5) = -1 / 540
  30. (B^S)_1( 6) = 859 / 2540160
  31. (B^S)_1( 7) = 71 / 483840
  32. (B^S)_1( 8) = -9769 / 36288000
  33. (B^S)_1( 9) = 233 / 896000
  34. (B^S)_1(10) = -6395527 / 31614105600
  35. (B^S)_1(11) = 145069 / 1149603840
  36. (B^S)_1(12) = -304991568097 / 7139902049280000
  37. (B^S)_1(13) = -95164619917 / 2196892938240000
  38. (B^S)_1(14) = 119780081383 / 941525544960000
  39. (B^S)_1(15) = -3046785293 / 15216574464000
  40. (B^S)_1(16) = 4002469707564917 / 16326052949606400000
  41. (B^S)_1(17) = -102407337854027 / 443241256550400000
  42. (B^S)_1(18) = 1286572077762833639 / 11991344662654156800000
  43. (B^S)_1(19) = 219276930957009857 / 1100420292929126400000
  44. (B^S)_1(20) = -20109624681057406222913 / 25964416811662737408000000
  45. (B^S)_1(21) = 1651690537394493957719 / 989120640444294758400000
  46. (B^S)_1(22) = -317111791627190377990199 / 114672159963196932096000000
  47. (B^S)_1(23) = 11537868018533936870610343 / 3350421369359492972544000000
  48. (B^S)_1(24) = -53268794333233082810667038099 / 27744839359665961305636864000000
  49. (B^S)_1(25) = -131365008403523370365114156231 / 22195871487732769044509491200000
  50. (B^S)_1(26) = 5728528307727220295170552267 / 204884967579071714257010688000
  51. (B^S)_1(27) = -575909751690138690377372607797 / 7588332132558211639148544000000
  52. (B^S)_1(28) = 36309996434261828839678688809299961 / 230769988036606221013588377600000000
  53. (B^S)_1(29) = -348737364778474586752969456387259 / 1446833780793769410743500800000000
  54. (B^S)_1(30) = 128926955111338066596432445962308410078213 / 870537324556366868721681061505925120000000