Ruby
A336940
60 = 2^2 * 3^1 * 5^1
A336940
60 = 2^2 * 3^1 * 5^1
の約数は、
1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60
であるが、このうち奇数のものは、
1, 3, 5, 15
である。これらは、
15 = 3^1 * 5^1
の約数である。
この考え方を使って、
n! の約数のうち奇数となるものの個数を求めてみた。
require 'prime'
def A(n)
h = {}
Prime.each(n * n){|i| h[i] = 1}
ary0 = []
ary1 = [1]
(1..n * n).each{|i|
i.prime_division.each{|j| h[j[0]] += j[1]}
ary0 << h[2]
ary1 << h.values.inject(:*) / h[2]
}
p ary0
p ary1
end
A(15)
出力結果
[1, 2, 2, 4, 4, 5, 5, 8, 8, 9, 9, 11, 11, 12, 12, 16, 16, 17, 17, 19, 19, 20, 20, 23, 23, 24, 24, 26, 26, 27, 27, 32, 32, 33, 33, 35, 35, 36, 36, 39, 39, 40, 40, 42, 42, 43, 43, 47, 47, 48, 48, 50, 50, 51, 51, 54, 54, 55, 55, 57, 57, 58, 58, 64, 64, 65, 65, 67, 67, 68, 68, 71, 71, 72, 72, 74, 74, 75, 75, 79, 79, 80, 80, 82, 82, 83, 83, 86, 86, 87, 87, 89, 89, 90, 90, 95, 95, 96, 96, 98, 98, 99, 99, 102, 102, 103, 103, 105, 105, 106, 106, 110, 110, 111, 111, 113, 113, 114, 114, 117, 117, 118, 118, 120, 120, 121, 121, 128, 128, 129, 129, 131, 131, 132, 132, 135, 135, 136, 136, 138, 138, 139, 139, 143, 143, 144, 144, 146, 146, 147, 147, 150, 150, 151, 151, 153, 153, 154, 154, 159, 159, 160, 160, 162, 162, 163, 163, 166, 166, 167, 167, 169, 169, 170, 170, 174, 174, 175, 175, 177, 177, 178, 178, 181, 181, 182, 182, 184, 184, 185, 185, 191, 191, 192, 192, 194, 194, 195, 195, 198, 198, 199, 199, 201, 201, 202, 202, 206, 206, 207, 207, 209, 209, 210, 210, 213, 213, 214, 214, 216, 216, 217, 217, 222, 222]
[1, 1, 1, 2, 2, 4, 6, 12, 12, 20, 30, 60, 72, 144, 216, 336, 336, 672, 864, 1728, 2160, 3200, 4800, 9600, 10560, 14784, 22176, 28224, 35280, 70560, 86400, 172800, 172800, 245760, 368640, 497664, 559872, 1119744, 1679616, 2363904, 2626560, 5253120, 6451200, 12902400, 16128000, 19514880, 29272320, 58544640, 61205760, 78693120, 93000960, 129392640, 161740800, 323481600, 363916800, 470292480, 522547200, 722534400, 1083801600, 2167603200, 2405376000, 4810752000, 7216128000, 8485171200, 8485171200, 10861019136, 13079937024, 26159874048, 32699842560, 44962283520, 52115374080, 104230748160, 110547763200, 221095526400, 331643289600, 381250437120, 476563046400, 590030438400, 707490201600, 1414980403200, 1489453056000, 1650475008000, 2475712512000, 4951425024000, 5462360064000, 6882573680640, 10323860520960, 14092888965120, 15854500085760, 31709000171520, 34764020121600, 42568187904000, 53210234880000, 72523579392000, 108785369088000, 136476190310400, 139443064012800, 278886128025600, 316070945095680, 366134191718400, 397971947520000, 795943895040000, 947552256000000, 1895104512000000, 2131992576000000, 2394654061363200, 3591981092044800, 7183962184089600, 7606548194918400, 15213096389836800, 17378037029928960, 23599803373977600, 24910903561420800, 49821807122841600, 59182267855011840, 73649044441792512, 92061305552240640, 105943565913292800, 158915348869939200, 191176359542784000, 201417950232576000, 238039395729408000, 357059093594112000, 484147923517440000, 605184904396800000, 667790239334400000, 724552409677824000, 1449104819355648000, 1449104819355648000, 1963303303643136000, 2227122185070182400, 4454244370140364800, 4873019481862963200, 5834363461278105600, 8751545191917158400, 9439403384084889600, 10619328807095500800, 21238657614191001600, 25148261254614220800, 50296522509228441600, 54129278903648256000, 73233730281406464000, 109850595422109696000, 128396799844024320000, 132118446216314880000, 163071910758422937600, 244607866137634406400, 269622877555261440000, 337028596944076800000, 674057193888153600000, 721386827100979200000, 1442773654201958400000, 1623120360977203200000, 1852877124403200000000, 2055458356671283200000, 2531459239268843520000, 2778979698219574886400, 5557959396439149772800, 8336939094658724659200, 11262180882258277171200, 11550954751034130432000, 13708825418809737216000, 14420972193812840448000, 28841944387625680896000, 36052430484532101120000, 39748082791530627072000, 59622124187295940608000, 119244248374591881216000, 125168759359779373056000, 144425491568976199680000, 162742870987480498176000, 185182651056704716800000, 231478313820880896000000, 462956627641761792000000, 546470372235961958400000, 592938941303645798400000, 627817702556801433600000, 846823877867313561600000, 1270235816800970342400000, 2540471633601940684800000, 2657938582177579008000000, 5315877164355158016000000, 5865795491702243328000000, 7908937741621002240000000, 8897554959323627520000000, 10914334083436983091200000, 12874871872498811535360000, 14825610034998631464960000, 18532012543748289331200000, 19781056612630957916160000, 22232187540717837484032000, 44464375081435674968064000, 44937400348259458744320000, 89874800696518917488640000, 134812201044778376232960000, 147825428066122044801024000, 157362552457484757368832000, 314725104914969514737664000, 338191450456875136450560000, 676382900913750272901120000, 704565521785156534272000000, 949006621180006760448000000, 1423509931770010140672000000, 1676167538707544408064000000, 1834190067609265766400000000, 2245048642753741298073600000, 3367572964130611947110400000, 3816582692681360206725120000, 4041087556956734336532480000, 4628882110695895694573568000, 4906089515746503646248960000, 9812179031493007292497920000, 12265223789366259115622400000, 16512404842641954019737600000, 24768607263962931029606400000, 30293911961308507951595520000, 31167774806346253373276160000, 36638037323378452944912384000, 54957055985067679417368576000, 73960897774296690057019392000, 78944785764478407715848192000, 89740653903210497659895808000, 105666850197761743386574848000, 211333700395523486773149696000, 217204080962065805850181632000, 229381679792762665505390592000]
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。