2022年11月19日土曜日

221119

Ruby


A030717

出力してみた。

def A(n)
  p ary = [1]
  (n - 1).times{
    p a = ary.uniq.sort.map{|i| ary.count(i)}
    ary += a
  }
  ary
end

A(20)

出力結果
[1]
[1]
[2]
[2, 1]
[3, 2]
[3, 3, 1]
[4, 3, 3]
[4, 3, 5, 1]
[5, 3, 6, 2, 1]
[6, 4, 7, 2, 2, 1]
[7, 6, 7, 3, 2, 2, 1]
[8, 8, 8, 3, 2, 3, 3]
[8, 9, 11, 3, 2, 3, 3, 3]
[8, 10, 15, 3, 2, 3, 3, 4, 1, 1]
[10, 11, 18, 4, 2, 3, 3, 5, 1, 1, 1, 1]
[14, 12, 20, 5, 3, 3, 3, 5, 1, 2, 2, 1, 1]
[17, 14, 23, 5, 5, 3, 3, 5, 1, 2, 2, 1, 1, 1, 1, 1]
[23, 16, 25, 5, 8, 3, 3, 5, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1]
[30, 19, 27, 5, 10, 3, 3, 6, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1]
[38, 23, 29, 5, 11, 4, 3, 6, 1, 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1]

2022年10月2日日曜日

221002

PARI


A357392, A357393等

出力してみた。

A(n) = my(N=15, x='x+O('x^N)); sum(k=1, N, binomial(n*k, k)*x^k/(n*k));
B(n) = exp(A(n));
C(n) = B(n)-x*exp(n*A(n));

for(n=1, 5, print(Vec(serlaplace(A(n)))))
for(n=1, 5, print(Vec(B(n))))
for(n=1, 5, print(C(n)))

出力結果
[1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 6227020800]
[1, 3, 20, 210, 3024, 55440, 1235520, 32432400, 980179200, 33522128640, 1279935820800, 53970627110400, 2490952020480000, 124903451312640000]
[1, 5, 56, 990, 24024, 742560, 27907200, 1235591280, 62990928000, 3634245014400, 234102016512000, 16654322805120000, 1296884927852236800, 109720581991308288000]
[1, 7, 110, 2730, 93024, 4037880, 213127200, 13253058000, 948964262400, 76899763100160, 6957624460550400, 695236239163065600, 76043127767523840000, 9036546669251861760000]
[1, 9, 182, 5814, 255024, 14250600, 968330880, 77519922480, 7146019520640, 745520860465920, 86839771951296000, 11171585428619616000, 1573144097507348889600, 240679032790296606105600]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440]
[1, 1, 3, 12, 55, 273, 1428, 7752, 43263, 246675, 1430715, 8414640, 50067108, 300830572, 1822766520]
[1, 1, 4, 22, 140, 969, 7084, 53820, 420732, 3362260, 27343888, 225568798, 1882933364, 15875338990, 134993766600]
[1, 1, 5, 35, 285, 2530, 23751, 231880, 2330445, 23950355, 250543370, 2658968130, 28558343775, 309831575760, 3390416787880]
1 + O(x^15)
1 + O(x^15)
1 + O(x^15)
1 + O(x^15)
1 + O(x^15)

2022年9月18日日曜日

220918

Ruby


Greedy algorithm for Egyptian fractions

mを動かして、m/nをGreedy algorithmでエジプト式分数にしたときに分母が大きなものが出るようにしてみた。

def A(x, y)
  m = y / x
  m += 1 if y % x > 0
  m
end

def B(n, a = [])
  return [1] if n == 1
  x, y = n.numerator, n.denominator
  return a if y == 1
  m = A(x, y)
  a << m
  x, y = (-y) % x, y * m
  n = x.to_r / y
  return B(n, a)
end

def show(a, b, ary)
  print "#{a}/#{b} = 1/#{ary[0]}"
  ary[1..-1].each{|i|
    print " + 1/#{i}"
  }
  puts
end

def C(n)
  (2..n).each{|i|
    max = 0
    m = 0
    ary = []
    (1..i - 1).each{|j|
      x = j.to_r / i
      a = B(x)
      b = a[-1]
      if max < b
        max = b
        m = j
        ary = a
      end
    }
    show(m, i, ary)
  }
end

n = 200
ary = C(n)

出力結果
1/2 = 1/2
2/3 = 1/2 + 1/6
1/4 = 1/4
4/5 = 1/2 + 1/4 + 1/20
1/6 = 1/6
3/7 = 1/3 + 1/11 + 1/231
3/8 = 1/3 + 1/24
2/9 = 1/5 + 1/45
3/10 = 1/4 + 1/20
8/11 = 1/2 + 1/5 + 1/37 + 1/4070
1/12 = 1/12
3/13 = 1/5 + 1/33 + 1/2145
6/14 = 1/3 + 1/11 + 1/231
2/15 = 1/8 + 1/120
7/16 = 1/3 + 1/10 + 1/240
4/17 = 1/5 + 1/29 + 1/1233 + 1/3039345
4/18 = 1/5 + 1/45
14/19 = 1/2 + 1/5 + 1/28 + 1/887 + 1/2359420
9/20 = 1/3 + 1/9 + 1/180
17/21 = 1/2 + 1/4 + 1/17 + 1/1428
5/22 = 1/5 + 1/37 + 1/4070
7/23 = 1/4 + 1/19 + 1/583 + 1/1019084
5/24 = 1/5 + 1/120
4/25 = 1/7 + 1/59 + 1/5163 + 1/53307975
6/26 = 1/5 + 1/33 + 1/2145
20/27 = 1/2 + 1/5 + 1/25 + 1/1350
11/28 = 1/3 + 1/17 + 1/1428
27/29 = 1/2 + 1/3 + 1/11 + 1/148 + 1/28328 + 1/1003066152
4/30 = 1/8 + 1/120
5/31 = 1/7 + 1/55 + 1/3979 + 1/23744683 + 1/1127619917796295
5/32 = 1/7 + 1/75 + 1/16800
5/33 = 1/7 + 1/116 + 1/26796
8/34 = 1/5 + 1/29 + 1/1233 + 1/3039345
29/35 = 1/2 + 1/4 + 1/13 + 1/607 + 1/1104740
5/36 = 1/8 + 1/72
11/37 = 1/4 + 1/22 + 1/543 + 1/884004
9/38 = 1/5 + 1/28 + 1/887 + 1/2359420
31/39 = 1/2 + 1/4 + 1/23 + 1/718 + 1/1288092
17/40 = 1/3 + 1/11 + 1/1320
36/41 = 1/2 + 1/3 + 1/23 + 1/809 + 1/915465 + 1/1396792694910
13/42 = 1/4 + 1/17 + 1/1428
7/43 = 1/7 + 1/51 + 1/3071 + 1/11785731 + 1/185204595153417
7/44 = 1/7 + 1/62 + 1/9548
14/45 = 1/4 + 1/17 + 1/438 + 1/223380
14/46 = 1/4 + 1/19 + 1/583 + 1/1019084
35/47 = 1/2 + 1/5 + 1/23 + 1/832 + 1/1498987 + 1/6740884579520
11/48 = 1/5 + 1/35 + 1/1680
19/49 = 1/3 + 1/19 + 1/559 + 1/780644 + 1/1218809328828
8/50 = 1/7 + 1/59 + 1/5163 + 1/53307975
12/51 = 1/5 + 1/29 + 1/1233 + 1/3039345
5/52 = 1/11 + 1/191 + 1/109252
44/53 = 1/2 + 1/4 + 1/13 + 1/307 + 1/120871 + 1/20453597227 + 1/697249399186783218655 + 1/1458470173998990524806872692984177836808420
13/54 = 1/5 + 1/25 + 1/1350
48/55 = 1/2 + 1/3 + 1/26 + 1/1073 + 1/2301585
11/56 = 1/6 + 1/34 + 1/2856
42/57 = 1/2 + 1/5 + 1/28 + 1/887 + 1/2359420
25/58 = 1/3 + 1/11 + 1/148 + 1/28328 + 1/1003066152
17/59 = 1/4 + 1/27 + 1/911 + 1/1160979 + 1/2246452569756
7/60 = 1/9 + 1/180
5/61 = 1/13 + 1/199 + 1/52603 + 1/4150560811 + 1/34454310087467394631
10/62 = 1/7 + 1/55 + 1/3979 + 1/23744683 + 1/1127619917796295
46/63 = 1/2 + 1/5 + 1/34 + 1/1339 + 1/7170345
7/64 = 1/10 + 1/107 + 1/34240
4/65 = 1/17 + 1/369 + 1/203873 + 1/83128196385
10/66 = 1/7 + 1/116 + 1/26796
60/67 = 1/2 + 1/3 + 1/17 + 1/298 + 1/101827 + 1/25921742996 + 1/1343873519875428369036
15/68 = 1/5 + 1/49 + 1/5554 + 1/46264820
11/69 = 1/7 + 1/61 + 1/5893 + 1/86812730 + 1/15072900093293070
23/70 = 1/4 + 1/13 + 1/607 + 1/1104740
53/71 = 1/2 + 1/5 + 1/22 + 1/977 + 1/1271729 + 1/2425940702433 + 1/11770376583439808963536545
11/72 = 1/7 + 1/101 + 1/50904
18/73 = 1/5 + 1/22 + 1/893 + 1/1024399 + 1/2448583368404 + 1/8993340768034569594892420
22/74 = 1/4 + 1/22 + 1/543 + 1/884004
12/75 = 1/7 + 1/59 + 1/5163 + 1/53307975
17/76 = 1/5 + 1/43 + 1/2335 + 1/7630780
47/77 = 1/2 + 1/10 + 1/97 + 1/12449 + 1/232453953 + 1/108069680298198465
23/78 = 1/4 + 1/23 + 1/718 + 1/1288092
39/79 = 1/3 + 1/7 + 1/58 + 1/4184 + 1/40259285 + 1/8104050103296840
39/80 = 1/3 + 1/7 + 1/89 + 1/13593 + 1/677475120
20/81 = 1/5 + 1/22 + 1/686 + 1/764033 + 1/1167492086145
31/82 = 1/3 + 1/23 + 1/809 + 1/915465 + 1/1396792694910
61/83 = 1/2 + 1/5 + 1/29 + 1/2189 + 1/5854359 + 1/308461667853570
19/84 = 1/5 + 1/39 + 1/1820
33/85 = 1/3 + 1/19 + 1/441 + 1/356108 + 1/253625459220
14/86 = 1/7 + 1/51 + 1/3071 + 1/11785731 + 1/185204595153417
70/87 = 1/2 + 1/4 + 1/19 + 1/509 + 1/673102 + 1/1132665082908
43/88 = 1/3 + 1/7 + 1/81 + 1/9980 + 1/124490520
50/89 = 1/2 + 1/17 + 1/337 + 1/145681 + 1/29711989585 + 1/1471337208468868797457 + 1/6494499543074890436870241790813851000203090
28/90 = 1/4 + 1/17 + 1/438 + 1/223380
5/91 = 1/19 + 1/433 + 1/249553 + 1/93414800161 + 1/17452649778145716451681
9/92 = 1/11 + 1/145 + 1/48914 + 1/3588820180
15/93 = 1/7 + 1/55 + 1/3979 + 1/23744683 + 1/1127619917796295
23/94 = 1/5 + 1/23 + 1/832 + 1/1498987 + 1/6740884579520
62/95 = 1/2 + 1/7 + 1/103 + 1/15222 + 1/260657723 + 1/135884896858431735
23/96 = 1/5 + 1/26 + 1/892 + 1/1391520
8/97 = 1/13 + 1/181 + 1/38041 + 1/1736503177 + 1/3769304102927363485 + 1/18943537893793408504192074528154430149 + 1/538286441900380211365817285104907086347439746130226973253778132494225813153 + 1/579504587067542801713103191859918608251030291952195423583529357653899418686342360361798689053273749372615043661810228371898539583862011424993909789665
38/98 = 1/3 + 1/19 + 1/559 + 1/780644 + 1/1218809328828
71/99 = 1/2 + 1/5 + 1/59 + 1/4494 + 1/21874545
49/100 = 1/3 + 1/7 + 1/73 + 1/9018 + 1/230409900
84/101 = 1/2 + 1/4 + 1/13 + 1/211 + 1/48182 + 1/3813853094 + 1/16969721322568415215 + 1/863914325296899369798407851627362073460
24/102 = 1/5 + 1/29 + 1/1233 + 1/3039345
24/103 = 1/5 + 1/31 + 1/1331 + 1/3035631 + 1/32252691452933 + 1/2080472211916162528417152045
51/104 = 1/3 + 1/7 + 1/71 + 1/9122 + 1/141449381 + 1/100039636784966424
31/105 = 1/4 + 1/23 + 1/569 + 1/422811 + 1/774665857980
35/106 = 1/4 + 1/13 + 1/307 + 1/120871 + 1/20453597227 + 1/697249399186783218655 + 1/1458470173998990524806872692984177836808420
64/107 = 1/2 + 1/11 + 1/139 + 1/36357 + 1/1699461221 + 1/4043435816656473957 + 1/27248955339034010790024973983708922458
17/108 = 1/7 + 1/69 + 1/17388
6/109 = 1/19 + 1/415 + 1/214867 + 1/61556888719 + 1/5683875823083467302723 + 1/64612888744465525793841376769540622379126735
41/110 = 1/3 + 1/26 + 1/1073 + 1/2301585
79/111 = 1/2 + 1/5 + 1/86 + 1/11933 + 1/284781045
25/112 = 1/5 + 1/44 + 1/2054 + 1/6326320
14/113 = 1/9 + 1/79 + 1/8035 + 1/92222287 + 1/14883662791920859 + 1/886093672414437662516188885270665
27/114 = 1/5 + 1/28 + 1/887 + 1/2359420
73/115 = 1/2 + 1/8 + 1/103 + 1/13538 + 1/213810147 + 1/137144336666674680
45/116 = 1/3 + 1/19 + 1/509 + 1/673102 + 1/1132665082908
94/117 = 1/2 + 1/4 + 1/19 + 1/1271 + 1/2260347 + 1/8515278673668
34/118 = 1/4 + 1/27 + 1/911 + 1/1160979 + 1/2246452569756
111/119 = 1/2 + 1/3 + 1/11 + 1/118 + 1/17823 + 1/688244057 + 1/947359763303394441
19/120 = 1/7 + 1/65 + 1/10920
5/121 = 1/25 + 1/757 + 1/763309 + 1/873960180913 + 1/1527612795642093418846225
10/122 = 1/13 + 1/199 + 1/52603 + 1/4150560811 + 1/34454310087467394631
89/123 = 1/2 + 1/5 + 1/43 + 1/3112 + 1/11756692 + 1/241884650113320
20/124 = 1/7 + 1/55 + 1/3979 + 1/23744683 + 1/1127619917796295
123/125 = 1/2 + 1/3 + 1/7 + 1/129 + 1/17366 + 1/490046813 + 1/480291757372867125
29/126 = 1/5 + 1/34 + 1/1339 + 1/7170345
63/127 = 1/3 + 1/7 + 1/51 + 1/3779 + 1/19037343 + 1/543630623712131 + 1/591068510075280592134089410191
7/128 = 1/19 + 1/487 + 1/394795 + 1/467588881280
21/129 = 1/7 + 1/51 + 1/3071 + 1/11785731 + 1/185204595153417
8/130 = 1/17 + 1/369 + 1/203873 + 1/83128196385
65/131 = 1/3 + 1/7 + 1/51 + 1/2599 + 1/8103163 + 1/82076555152549 + 1/8982081207612474990993110653 + 1/121016674230217765593132828801254329768662133572660018961 + 1/29290070883485305257170727916346131549433432526041820570286255057924204445456330131039739635641147751253099020081
31/132 = 1/5 + 1/29 + 1/2735 + 1/10469580
44/133 = 1/4 + 1/13 + 1/257 + 1/77279 + 1/27471324390 + 1/1886684159324050855860
53/134 = 1/3 + 1/17 + 1/298 + 1/101827 + 1/25921742996 + 1/1343873519875428369036
44/135 = 1/4 + 1/14 + 1/223 + 1/76631 + 1/64595335140
11/136 = 1/13 + 1/253 + 1/149102 + 1/33346960504
106/137 = 1/2 + 1/4 + 1/43 + 1/2143 + 1/5610851 + 1/40476400174551 + 1/2293674559526508636175097691 + 1/8768238308365205681757381048272405318708454952814121444
22/138 = 1/7 + 1/61 + 1/5893 + 1/86812730 + 1/15072900093293070
66/139 = 1/3 + 1/8 + 1/61 + 1/10711 + 1/167665051 + 1/52207200010738351 + 1/19079142130728669285180785264656056
53/140 = 1/3 + 1/23 + 1/569 + 1/422811 + 1/774665857980
23/141 = 1/7 + 1/50 + 1/3797 + 1/17034723 + 1/1063999871149950
35/142 = 1/5 + 1/22 + 1/977 + 1/1271729 + 1/2425940702433 + 1/11770376583439808963536545
32/143 = 1/5 + 1/43 + 1/1922 + 1/8441699 + 1/166278649573704 + 1/41472883956081813852742845720
11/144 = 1/14 + 1/202 + 1/101808
9/145 = 1/17 + 1/309 + 1/108813 + 1/13813538318 + 1/381627681711894999930
36/146 = 1/5 + 1/22 + 1/893 + 1/1024399 + 1/2448583368404 + 1/8993340768034569594892420
8/147 = 1/19 + 1/559 + 1/780644 + 1/1218809328828
71/148 = 1/3 + 1/7 + 1/283 + 1/175913 + 1/154726741932
40/149 = 1/4 + 1/55 + 1/3643 + 1/17059649 + 1/679073772281154 + 1/691711782300234218923463076420
24/150 = 1/7 + 1/59 + 1/5163 + 1/53307975
130/151 = 1/2 + 1/3 + 1/37 + 1/1765 + 1/4551257 + 1/24480106688801 + 1/6592031858445849582740304810
25/152 = 1/7 + 1/47 + 1/2942 + 1/24520590 + 1/901888976401560
112/153 = 1/2 + 1/5 + 1/32 + 1/1289 + 1/2868611 + 1/90518216893920
17/154 = 1/10 + 1/97 + 1/12449 + 1/232453953 + 1/108069680298198465
86/155 = 1/2 + 1/19 + 1/454 + 1/222839 + 1/74485607043 + 1/11096211313053936800655
25/156 = 1/7 + 1/58 + 1/6334 + 1/100292556
13/157 = 1/13 + 1/171 + 1/31729 + 1/1384221253 + 1/3065709562226802762 + 1/15664291866548091057524723739191244978
78/158 = 1/3 + 1/7 + 1/58 + 1/4184 + 1/40259285 + 1/8104050103296840
132/159 = 1/2 + 1/4 + 1/13 + 1/307 + 1/120871 + 1/20453597227 + 1/697249399186783218655 + 1/1458470173998990524806872692984177836808420
78/160 = 1/3 + 1/7 + 1/89 + 1/13593 + 1/677475120
102/161 = 1/2 + 1/8 + 1/118 + 1/15199 + 1/385000803 + 1/444676854546933624
40/162 = 1/5 + 1/22 + 1/686 + 1/764033 + 1/1167492086145
39/163 = 1/5 + 1/26 + 1/1247 + 1/2935993 + 1/11082924787499 + 1/286606184305828343790787504 + 1/123214657323519667859049566141092194172466586933037520
39/164 = 1/5 + 1/27 + 1/1303 + 1/2622584 + 1/18914351179320
134/165 = 1/2 + 1/4 + 1/17 + 1/304 + 1/121818 + 1/17312774160
39/166 = 1/5 + 1/29 + 1/2189 + 1/5854359 + 1/308461667853570
100/167 = 1/2 + 1/11 + 1/127 + 1/51845 + 1/3455824759 + 1/27866357781351460764 + 1/1164800843997430660100641743273595734780
41/168 = 1/5 + 1/23 + 1/1757 + 1/4849320
101/169 = 1/2 + 1/11 + 1/149 + 1/79141 + 1/8768537893 + 1/128145427959526261189 + 1/49263752120790404508611388524063616819974
66/170 = 1/3 + 1/19 + 1/441 + 1/356108 + 1/253625459220
17/171 = 1/11 + 1/118 + 1/31709 + 1/1407613245 + 1/3302291744424770130
37/172 = 1/5 + 1/67 + 1/5239 + 1/33541243 + 1/1446447800439535 + 1/2929095735154914968387066983180
96/173 = 1/2 + 1/19 + 1/439 + 1/262363 + 1/108167992132 + 1/13650366942071648230863 + 1/558997552959607441944152226025691321588943444
53/174 = 1/4 + 1/19 + 1/509 + 1/673102 + 1/1132665082908
52/175 = 1/4 + 1/22 + 1/593 + 1/507345 + 1/463317600900
39/176 = 1/5 + 1/47 + 1/3182 + 1/21934587 + 1/1443378298647120
127/177 = 1/2 + 1/5 + 1/58 + 1/3667 + 1/23528389 + 1/2214340332212895
11/178 = 1/17 + 1/337 + 1/145681 + 1/29711989585 + 1/1471337208468868797457 + 1/6494499543074890436870241790813851000203090
144/179 = 1/2 + 1/4 + 1/19 + 1/545 + 1/353057 + 1/153978126369 + 1/31004421369217672882150 + 1/1249656387772001920982167116032051316452327100
17/180 = 1/11 + 1/283 + 1/560340
6/181 = 1/31 + 1/1123 + 1/1575289 + 1/3308712336073 + 1/16421365984319164633255921 + 1/539322521581909053519582180808841844787134329860561
10/182 = 1/19 + 1/433 + 1/249553 + 1/93414800161 + 1/17452649778145716451681
15/183 = 1/13 + 1/199 + 1/52603 + 1/4150560811 + 1/34454310087467394631
15/184 = 1/13 + 1/218 + 1/86910 + 1/11329935240
169/185 = 1/2 + 1/3 + 1/13 + 1/308 + 1/96619 + 1/12629922011 + 1/387393401425515625140
30/186 = 1/7 + 1/55 + 1/3979 + 1/23744683 + 1/1127619917796295
135/187 = 1/2 + 1/5 + 1/46 + 1/5377 + 1/38544129 + 1/2228474782008833 + 1/9932199708098629290522998034945
89/188 = 1/3 + 1/8 + 1/67 + 1/6871 + 1/103856540 + 1/13482726022107960
110/189 = 1/2 + 1/13 + 1/197 + 1/88006 + 1/10649364044 + 1/226817909072630703828
29/190 = 1/7 + 1/103 + 1/15222 + 1/260657723 + 1/135884896858431735
148/191 = 1/2 + 1/4 + 1/41 + 1/2089 + 1/5948713 + 1/55608429754153 + 1/7215360739352604644951989802 + 1/78092145898486448316413360318084768475684343693716009004
19/192 = 1/11 + 1/125 + 1/20308 + 1/1340328000
51/193 = 1/4 + 1/71 + 1/6091 + 1/47694271 + 1/3184640833015747 + 1/16903228725518715094350416930935 + 1/857157424041603136173297512143544981234507697558703363262991740
16/194 = 1/13 + 1/181 + 1/38041 + 1/1736503177 + 1/3769304102927363485 + 1/18943537893793408504192074528154430149 + 1/538286441900380211365817285104907086347439746130226973253778132494225813153 + 1/579504587067542801713103191859918608251030291952195423583529357653899418686342360361798689053273749372615043661810228371898539583862011424993909789665
157/195 = 1/2 + 1/4 + 1/19 + 1/401 + 1/349578 + 1/346246521660
76/196 = 1/3 + 1/19 + 1/559 + 1/780644 + 1/1218809328828
58/197 = 1/4 + 1/23 + 1/1067 + 1/1289221 + 1/3561621825439 + 1/17759210038417246800734371 + 1/525649235314366514313374231178048734749528033875031 + 1/828921355759734781847129205289349573374693956396002400876921135513991799841861945209498105233141877852
43/198 = 1/5 + 1/59 + 1/4494 + 1/21874545
11/199 = 1/19 + 1/379 + 1/159223 + 1/28520799973 + 1/929641178371338400861 + 1/1008271507277592391123742528036634174730681 + 1/1219933718865393655364635368068124756713122928811333803786753398211072842948484537833 + 1/1860297848030936654742608399135821395565274404917258533393305147319524009551744684579405649080712180254407780735949179513154143641842892458088536544987153757401025882029 + 1/4614277444518045184646591832326467411359277711335974416082881814986405515888533562332069783067894981850924485553345190160771506460024406127868096951360637582674289834858262576425271895218431296391169922044160278696744025988461165811212428548328350795432691637759392474030879286312785400132190057899968737693594392669884878193448874327093 + 1/31937334502481972335865307630139228000187060941658399518862518849553429993133277230560087986574331290756232125775998863890963263813589266879406694561350952988662850757053371133819179770003609046815203982179108798005308113258134895569927488690118483730232440575942894680942308888321353318333183158977270294582315388855860989819894602178852719674244639951777398683083694723999674418435726557523519535770015019287382321071804865681731226989916286199314883016472947639367666251368202759691810399195092598892275413777035275182318485652713871000041272524440519262054008953943029365257325370839037761555465335452562216651250516983405134378252470216494582635109781712938341456418881 + 1/2039986670246850822853427080268636607703538330430958135006350872460188775376402385474575383380701179275926633909293920375037781006938834602683282504456671345800481611955974906577358109966753513899436209725756764159504134559394933538420714469300931804842468643272796657406808805007786178371184391663721349034183315512035012402176731111044506314978549915206516847224339930494935465558632905912262959736737614637514921726288403470224139024425700070180324623265095949577758695292697562554242228453440276043742370033993859881981612938703208463591285870376619588297958810138295747858827756577616148419423031480258559516303907719233914603343421735341220080271152090557188286289527661792734931298102513902518914250419121432886312102736349552224188669212688846219382874287241971706387850290821170997846726526589069990513808709560793139660289273086403155344460608865436195352720549406793512677065107181955781264579349071905411393100989250722104770801720673437692418988638492506057962758754921169589084980707251205329924087857682559921447010465898318288868258062129919867004394488124710647843586978379399594154917914477913086776811741840849911967039211773201428676384229432761943488196359561416605048969002045397348240530911560634680322446588472763785839765588633770016209055874572792498932175778494089116461654628549726895871636209026849103988563732410165441
9/200 = 1/23 + 1/658 + 1/504467 + 1/763460357800

2022年8月19日金曜日

220819

PARI


ラマヌジャンの立方連分数等

ラマヌジャンの立方連分数およびラマヌジャン - ゴールニッツ - ゴードンの連分数をそれぞれ展開したものを出力してみた。

N=50;
f(a, b, n) = prod(k=1, n, (1-(a*b)^k)*(1+a*(a*b)^(k-1))*(1+b*(a*b)^(k-1))+x*O(x^n));
g1 = f(  -x, -x^5, N);
h1 = f(-x^3, -x^3, N);
g2 = f(  -x, -x^7, N);
h2 = f(-x^3, -x^5, N);
print(Vec(g1))
print(Vec(h1))
print(Vec(g1/h1)) \\ A092848
print(Vec(g2))
print(Vec(h2))
print(Vec(g2/h2)) \\ A092869

出力結果
[1, -1, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0]
[1, -1, 0, 2, -2, -1, 4, -4, -1, 8, -8, -2, 14, -14, -4, 24, -23, -6, 40, -38, -10, 63, -60, -16, 98, -92, -24, 150, -140, -36, 224, -208, -54, 329, -304, -78, 478, -440, -112, 684, -627, -160, 968, -884, -224, 1358, -1236, -312, 1884, -1710, -432]
[1, -1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0]
[1, 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, -1, 0, 1, -1, 1, 0, -2, 2, -1, 0, 2, -3, 2, 0, -2, 4, -4, 0, 4, -6, 5, 0, -6, 9, -6, 0, 7, -12, 9, 0, -10, 16, -13, 0, 15, -22, 17, 0, -20, 29, -21, 0, 25, -38, 28, 0, -32, 50, -39, 0]

2022年7月8日金曜日

220708

Ruby


素数を生成する漸化式

2008年Rowlandにより、以下の数列は1または素数しか現れないことが証明されている。

def A106108(n)
  ary = [7]
  (2..n).each{|i| ary << ary[-1] + i.gcd(ary[-1])}
  ary
end

def A132199(n)
  ary = A106108(n + 1)
  (1..n).map{|i| ary[i] - ary[i - 1]}
end

n = 100
p A132199(n)

出力結果
[1, 1, 1, 5, 3, 1, 1, 1, 1, 11, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 23, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 3, 1, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 101]

2022年6月25日土曜日

220625

PARI


A355133等

似た数列を出力してみた。

M=10;

a355133(n) = if(n==0, 1, sum(k=1, n,            k*2^k    *stirling(n, k, 1)*a355133(k-1)));
for(n=0, M, print1(a355133(n), ", "))
b355208(n) = if(n==0, 1, sum(k=1, n,              2^k    *stirling(n, k, 1)*b355208(k-1)));
a355208(n) = b355208(n-1);
for(n=1, M, print1(a355208(n), ", "))

a355134(n) = if(n==0, 1, sum(k=1, n, (-1)^(n-k)*k*2^k    *stirling(n, k, 1)*a355134(k-1)));
for(n=0, M, print1(a355134(n), ", "))
b355209(n) = if(n==0, 1, sum(k=1, n, (-1)^(n-k)  *2^k    *stirling(n, k, 1)*b355209(k-1)));
a355209(n) = b355209(n-1);
for(n=1, M, print1(a355209(n), ", "))

a355131(n) = if(n==0, 1, sum(k=1, n,            k*2^k    *stirling(n, k, 2)*a355131(k-1)));
for(n=0, M, print1(a355131(n), ", "))
b355210(n) = if(n==0, 1, sum(k=1, n,              2^k    *stirling(n, k, 2)*b355210(k-1)));
a355210(n) = b355210(n-1);
for(n=1, M, print1(a355210(n), ", "))

a355132(n) = if(n==0, 1, sum(k=1, n, (-1)^(n-k)*k*2^k    *stirling(n, k, 2)*a355132(k-1)));
for(n=0, M, print1(a355132(n), ", "))
b355211(n) = if(n==0, 1, sum(k=1, n, (-1)^(n-k)  *2^k    *stirling(n, k, 2)*b355211(k-1)));
a355211(n) = b355211(n-1);
for(n=1, M, print1(a355211(n), ", "))

a355120(n) = if(n==0, 1, sum(k=1, n,            k*2^(k-1)*stirling(n, k, 1)*a355120(k-1)));
for(n=0, M, print1(a355120(n), ", "))
b355214(n) = if(n==0, 1, sum(k=1, n,              2^(k-1)*stirling(n, k, 1)*b355214(k-1)));
a355214(n) = b355214(n-1);
for(n=1, M, print1(a355214(n), ", "))

a355121(n) = if(n==0, 1, sum(k=1, n, (-1)^(n-k)*k*2^(k-1)*stirling(n, k, 1)*a355121(k-1)));
for(n=0, M, print1(a355121(n), ", "))
b355215(n) = if(n==0, 1, sum(k=1, n, (-1)^(n-k)  *2^(k-1)*stirling(n, k, 1)*b355215(k-1)));
a355215(n) = b355215(n-1);
for(n=1, M, print1(a355215(n), ", "))

a355122(n) = if(n==0, 1, sum(k=1, n,            k*2^(k-1)*stirling(n, k, 2)*a355122(k-1)));
for(n=0, M, print1(a355122(n), ", "))
b355216(n) = if(n==0, 1, sum(k=1, n,              2^(k-1)*stirling(n, k, 2)*b355216(k-1)));
a355216(n) = b355216(n-1);
for(n=1, M, print1(a355216(n), ", "))

a355123(n) = if(n==0, 1, sum(k=1, n, (-1)^(n-k)*k*2^(k-1)*stirling(n, k, 2)*a355123(k-1)));
for(n=0, M, print1(a355123(n), ", "))
b355217(n) = if(n==0, 1, sum(k=1, n, (-1)^(n-k)  *2^(k-1)*stirling(n, k, 2)*b355217(k-1)));
a355217(n) = b355217(n-1);
for(n=1, M, print1(a355217(n), ", "))

出力結果
1, 2, 14, 292, 16836, 2517888, 927979616, 811623678304, 1639230314891936, 7494183556478948928, 76401967141928846136512, 
1, 2, 6, 28, 236, 4400, 197552, 20430656, 4600591488, 2179887358272, 
1, 2, 18, 484, 33756, 5726688, 2282797376, 2092535127520, 4343501656698208, 20170260943214036928, 207447888426953360929472, 
1, 2, 10, 108, 2308, 94384, 7315728, 1077605632, 304189296192, 166216599473344, 
1, 2, 18, 482, 33554, 5688162, 2266828306, 2077710037986, 4312607047919378, 20026622857699101794, 205970083615742633015314, 
1, 2, 10, 106, 2234, 90570, 6986490, 1026623306, 289475035770, 158101579596106, 
1, 2, 14, 290, 16654, 2487202, 916292622, 801308046114, 1618342215277838, 7398618880762147490, 75427503900622910066190, 
1, 2, 6, 26, 182, 2746, 111350, 11245882, 2521162358, 1193350247226, 
1, 1, 3, 26, 654, 45084, 7934924, 3381663872, 3365978050576, 7632454575648720, 38732162420625498608, 
1, 1, 1, 0, -8, -64, -600, -14104, -1170120, -248815984, 
1, 1, 5, 74, 2778, 248244, 51212444, 23984832416, 25218677193200, 59000757443457072, 304720138059811544048, 
1, 1, 3, 20, 260, 6304, 281096, 23095768, 3534364152, 1022066008944, 
1, 1, 5, 73, 2725, 242921, 50068197, 23441365641, 24644653272869, 57655911504114985, 297771560486880287589, 
1, 1, 3, 19, 239, 5675, 249983, 20404811, 3112376543, 898693573515, 
1, 1, 3, 25, 611, 41721, 7326115, 3120454233, 3105527125475, 7041597540281017, 35733375744777784867, 
1, 1, 1, -1, -19, -153, -1155, -9785, -183075, -25013497, 

2022年5月7日土曜日

220507

Ruby


和と差の積を用いた素因数分解

nを素因数分解しようとすれば、√n 以下の素数を順番に割る方法もあるが、
受験数学では、和と差の積を用いた方法を使う方が速い場合が多い。

ここでは、後者の方法を実装してみた。
(ただし、偶数の場合は、2で割り続ければ、奇数になるので、
奇数の場合の素因数分解について考える。)

def is_square(n)
  n == Math.sqrt(n).to_i ** 2
end

def A(n)
  a = Math.sqrt(n).ceil
  while !is_square(a * a - n)
    a += 1 
  end
  b = Math.sqrt(a * a - n).to_i
  c, d = a - b, a + b
  return [A(c), A(d)] if c > 1
  [d]
end

n = 200
3.step(2 * n - 1, 2){|i| p [i, A(i)]}

出力結果
[3, [3]]
[5, [5]]
[7, [7]]
[9, [[3], [3]]]
[11, [11]]
[13, [13]]
[15, [[3], [5]]]
[17, [17]]
[19, [19]]
[21, [[3], [7]]]
[23, [23]]
[25, [[5], [5]]]
[27, [[3], [[3], [3]]]]
[29, [29]]
[31, [31]]
[33, [[3], [11]]]
[35, [[5], [7]]]
[37, [37]]
[39, [[3], [13]]]
[41, [41]]
[43, [43]]
[45, [[5], [[3], [3]]]]
[47, [47]]
[49, [[7], [7]]]
[51, [[3], [17]]]
[53, [53]]
[55, [[5], [11]]]
[57, [[3], [19]]]
[59, [59]]
[61, [61]]
[63, [[7], [[3], [3]]]]
[65, [[5], [13]]]
[67, [67]]
[69, [[3], [23]]]
[71, [71]]
[73, [73]]
[75, [[5], [[3], [5]]]]
[77, [[7], [11]]]
[79, [79]]
[81, [[[3], [3]], [[3], [3]]]]
[83, [83]]
[85, [[5], [17]]]
[87, [[3], [29]]]
[89, [89]]
[91, [[7], [13]]]
[93, [[3], [31]]]
[95, [[5], [19]]]
[97, [97]]
[99, [[[3], [3]], [11]]]
[101, [101]]
[103, [103]]
[105, [[7], [[3], [5]]]]
[107, [107]]
[109, [109]]
[111, [[3], [37]]]
[113, [113]]
[115, [[5], [23]]]
[117, [[[3], [3]], [13]]]
[119, [[7], [17]]]
[121, [[11], [11]]]
[123, [[3], [41]]]
[125, [[5], [[5], [5]]]]
[127, [127]]
[129, [[3], [43]]]
[131, [131]]
[133, [[7], [19]]]
[135, [[[3], [3]], [[3], [5]]]]
[137, [137]]
[139, [139]]
[141, [[3], [47]]]
[143, [[11], [13]]]
[145, [[5], [29]]]
[147, [[7], [[3], [7]]]]
[149, [149]]
[151, [151]]
[153, [[[3], [3]], [17]]]
[155, [[5], [31]]]
[157, [157]]
[159, [[3], [53]]]
[161, [[7], [23]]]
[163, [163]]
[165, [[11], [[3], [5]]]]
[167, [167]]
[169, [[13], [13]]]
[171, [[[3], [3]], [19]]]
[173, [173]]
[175, [[7], [[5], [5]]]]
[177, [[3], [59]]]
[179, [179]]
[181, [181]]
[183, [[3], [61]]]
[185, [[5], [37]]]
[187, [[11], [17]]]
[189, [[[3], [3]], [[3], [7]]]]
[191, [191]]
[193, [193]]
[195, [[13], [[3], [5]]]]
[197, [197]]
[199, [199]]
[201, [[3], [67]]]
[203, [[7], [29]]]
[205, [[5], [41]]]
[207, [[[3], [3]], [23]]]
[209, [[11], [19]]]
[211, [211]]
[213, [[3], [71]]]
[215, [[5], [43]]]
[217, [[7], [31]]]
[219, [[3], [73]]]
[221, [[13], [17]]]
[223, [223]]
[225, [[[3], [5]], [[3], [5]]]]
[227, [227]]
[229, [229]]
[231, [[11], [[3], [7]]]]
[233, [233]]
[235, [[5], [47]]]
[237, [[3], [79]]]
[239, [239]]
[241, [241]]
[243, [[[3], [3]], [[3], [[3], [3]]]]]
[245, [[7], [[5], [7]]]]
[247, [[13], [19]]]
[249, [[3], [83]]]
[251, [251]]
[253, [[11], [23]]]
[255, [[[3], [5]], [17]]]
[257, [257]]
[259, [[7], [37]]]
[261, [[[3], [3]], [29]]]
[263, [263]]
[265, [[5], [53]]]
[267, [[3], [89]]]
[269, [269]]
[271, [271]]
[273, [[13], [[3], [7]]]]
[275, [[11], [[5], [5]]]]
[277, [277]]
[279, [[[3], [3]], [31]]]
[281, [281]]
[283, [283]]
[285, [[[3], [5]], [19]]]
[287, [[7], [41]]]
[289, [[17], [17]]]
[291, [[3], [97]]]
[293, [293]]
[295, [[5], [59]]]
[297, [[11], [[3], [[3], [3]]]]]
[299, [[13], [23]]]
[301, [[7], [43]]]
[303, [[3], [101]]]
[305, [[5], [61]]]
[307, [307]]
[309, [[3], [103]]]
[311, [311]]
[313, [313]]
[315, [[[3], [5]], [[3], [7]]]]
[317, [317]]
[319, [[11], [29]]]
[321, [[3], [107]]]
[323, [[17], [19]]]
[325, [[13], [[5], [5]]]]
[327, [[3], [109]]]
[329, [[7], [47]]]
[331, [331]]
[333, [[[3], [3]], [37]]]
[335, [[5], [67]]]
[337, [337]]
[339, [[3], [113]]]
[341, [[11], [31]]]
[343, [[7], [[7], [7]]]]
[345, [[[3], [5]], [23]]]
[347, [347]]
[349, [349]]
[351, [[13], [[3], [[3], [3]]]]]
[353, [353]]
[355, [[5], [71]]]
[357, [[17], [[3], [7]]]]
[359, [359]]
[361, [[19], [19]]]
[363, [[11], [[3], [11]]]]
[365, [[5], [73]]]
[367, [367]]
[369, [[[3], [3]], [41]]]
[371, [[7], [53]]]
[373, [373]]
[375, [[[3], [5]], [[5], [5]]]]
[377, [[13], [29]]]
[379, [379]]
[381, [[3], [127]]]
[383, [383]]
[385, [[11], [[5], [7]]]]
[387, [[[3], [3]], [43]]]
[389, [389]]
[391, [[17], [23]]]
[393, [[3], [131]]]
[395, [[5], [79]]]
[397, [397]]
[399, [[19], [[3], [7]]]]

2022年4月24日日曜日

220424

Ruby


A064617のEXAMPLEの一般化

一般化してみた。

def A(k, n)
  (1..n).to_a.join.to_i(k)
end

def B(k, n)
  (k - n..k - 1).to_a.reverse.join.to_i(k)
end

(2..10).each{|i| 
  (1..i - 1).each{|j|
    a = A(i, j)
    b = B(i, j)
    puts "#{b} = #{a} * #{i - 2} + #{b - a * (i - 2)}"
  }
  p ""
}

出力結果
1 = 1 * 0 + 1
""
2 = 1 * 1 + 1
7 = 5 * 1 + 2
""
3 = 1 * 2 + 1
14 = 6 * 2 + 2
57 = 27 * 2 + 3
""
4 = 1 * 3 + 1
23 = 7 * 3 + 2
117 = 38 * 3 + 3
586 = 194 * 3 + 4
""
5 = 1 * 4 + 1
34 = 8 * 4 + 2
207 = 51 * 4 + 3
1244 = 310 * 4 + 4
7465 = 1865 * 4 + 5
""
6 = 1 * 5 + 1
47 = 9 * 5 + 2
333 = 66 * 5 + 3
2334 = 466 * 5 + 4
16340 = 3267 * 5 + 5
114381 = 22875 * 5 + 6
""
7 = 1 * 6 + 1
62 = 10 * 6 + 2
501 = 83 * 6 + 3
4012 = 668 * 6 + 4
32099 = 5349 * 6 + 5
256794 = 42798 * 6 + 6
2054353 = 342391 * 6 + 7
""
8 = 1 * 7 + 1
79 = 11 * 7 + 2
717 = 102 * 7 + 3
6458 = 922 * 7 + 4
58126 = 8303 * 7 + 5
523137 = 74733 * 7 + 6
4708235 = 672604 * 7 + 7
42374116 = 6053444 * 7 + 8
""
9 = 1 * 8 + 1
98 = 12 * 8 + 2
987 = 123 * 8 + 3
9876 = 1234 * 8 + 4
98765 = 12345 * 8 + 5
987654 = 123456 * 8 + 6
9876543 = 1234567 * 8 + 7
98765432 = 12345678 * 8 + 8
987654321 = 123456789 * 8 + 9
""

2022年3月13日日曜日

220313

Ruby


Expansion of e.g.f. 1/(1 - f(x)).

この形のe.g.f. を2通りで求めてみた。

def f(n)
  return 1 if n < 2
  (1..n).inject(:*)
end

def ncr(n, r)
  return 1 if r == 0
  (n - r + 1..n).inject(:*) / (1..r).inject(:*)
end

def gf_to_egf(ary)
  (0..ary.size - 1).map{|i| f(i) * ary[i]}
end

def I(ary, n)
  a = [1]
  (0..n - 1).each{|i| a << -(0..i).inject(0){|s, j| s + ary[1 + i - j] * a[j]}}
  a
end

def I_egf(ary, n)
  a = [1]
  (1..n).each{|i| a << -(1..i).inject(0){|s, j| s + ncr(i, j) * ary[j] * a[-j]}}
  a
end

# ary[0] = 0として扱われる
def A_1(ary, n)
  a = [1] + (1..n).map{|i| -ary[i]}
  gf_to_egf(I(a, n))
end

# a[0] = 0として扱われる
def A_2(ary, n)
  a = gf_to_egf(ary)
  b = [1] + (1..n).map{|i| -a[i]}
  I_egf(b, n) 
end

def A000670_1(n)
  ary = (0..n).map{|i| 1r / f(i)}
  A_1(ary, n).map(&:to_i)
end

def A000670_2(n)
  ary = (0..n).map{|i| 1r / f(i)}
  A_2(ary, n).map(&:to_i)
end

def A006153_1(n)
  ary = [0] + (0..n).map{|i| 1r / f(i)}
  A_1(ary, n).map(&:to_i)
end

def A006153_2(n)
  ary = [0] + (0..n).map{|i| 1r / f(i)}
  A_2(ary, n).map(&:to_i)
end

n = 10
p A000670_1(n)
p A000670_2(n)
p A006153_1(n)
p A006153_2(n)

出力結果
[1, 1, 3, 13, 75, 541, 4683, 47293, 545835, 7087261, 102247563]
[1, 1, 3, 13, 75, 541, 4683, 47293, 545835, 7087261, 102247563]
[1, 1, 4, 21, 148, 1305, 13806, 170401, 2403640, 38143377, 672552730]
[1, 1, 4, 21, 148, 1305, 13806, 170401, 2403640, 38143377, 672552730]

2022年2月11日金曜日

220211

Ruby


A010754とA010755

計算してみた。

def ncr(n, r)
  return 1 if r == 0
  (n - r + 1..n).inject(:*) / (1..r).inject(:*)
end

def A(n)
  (0..n).map{|i| (0..i / 2).map{|j| ncr(i - j, j)}.inject(:+)}
end

def A010754(n)
  (0..n).map{|i| (0..i / 2 / 2).map{|j| ncr(i - j, j)}.inject(:+)}
end

def A010755(n)
  (0..n).map{|i| (0..(i / 2 - 1) / 2).map{|j| ncr(i - j, j)}.inject(:+).to_i}
end

n = 50
p A(n)
p A010754(n)
p A010755(n)

出力結果
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903, 2971215073, 4807526976, 7778742049, 12586269025, 20365011074]
[1, 1, 1, 1, 4, 5, 6, 7, 23, 30, 38, 47, 141, 188, 245, 313, 888, 1201, 1594, 2080, 5676, 7756, 10429, 13817, 36622, 50439, 68497, 91804, 237821, 329625, 451166, 610247, 1551727, 2161974, 2978230, 4058629, 10161409, 14220038, 19694622, 27007760, 66732392, 93740152, 130427529, 179815516, 439267525, 619083041, 864813846, 1197799127, 2897064773, 4094863900, 5740250973]
[0, 0, 1, 1, 1, 1, 6, 7, 8, 9, 38, 47, 57, 68, 245, 313, 393, 486, 1594, 2080, 2673, 3388, 10429, 13817, 18058, 23307, 68497, 91804, 121541, 159081, 451166, 610247, 816256, 1080399, 2978230, 4058629, 5474584, 7313138, 19694622, 27007760, 36687377, 49387987, 130427529, 179815516, 245730805, 332985281, 864813846, 1197799127, 1645387073, 2242380904, 5740250973]