- 注册时间
- 2009-2-12
- 最后登录
- 1970-1-1
- 威望
- 星
- 金币
- 枚
- 贡献
- 分
- 经验
- 点
- 鲜花
- 朵
- 魅力
- 点
- 上传
- 次
- 下载
- 次
- 积分
- 22688
- 在线时间
- 小时
|
发表于 2010-5-7 12:08:34
|
显示全部楼层
总结一下:
序列{1,2,3,...,n}的K元均衡样本的个数a(n)是
$\prod_{s=1}^k{x^s-x^n}/{1-x^s}$
的展开式的x 的 floor((n+1)*k/2) 次幂的系数。
大一统的 Mathematica函数是:
- f[kk_, nn_] := Module[{k = kk, tmp, n = nn}, tmp = PadLeft[Table[SeriesCoefficient[Series[Product[(x^s - x^(m + 1))/(1 - x^s), {s, 1, k}], {x, 0, m k}], Floor[(m + 1) k/2]], {m, k, n}], n]; If[EvenQ[k], tmp, tmp[[1 ;; -1 ;; 2]]]]
复制代码 如计算7元:
In[11]:= f[7, 100]
Out[11]= {0, 0, 0, 1, 4, 24, 94, 289, 734, 1656, 3370, 6375, 11322, 19138, 30982, 48417, 73316, 108108, 155646, 219489, 303748, 413442, 554256, 733005, 957332, 1236222, 1579666, 1999265, 2507780, 3119876, 3851588, 4721127, 5748298, 6955424, 8366614, 10008857, 11911188, 14105854, 16627422, 19514081, 22806570, 26549686, 30791082, 35582861, 40980304, 47043624, 53836482, 61427973, 69890996, 79304338}
计算14元:
In[12]:= f[14, 100]
Out[12]= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 8, 32, 126, 414, 1242, 3370, 8512, 20094, 44916, 95514, 194668, 381676, 723354, 1328980, 2374753, 4136477, 7040196, 11728606, 19159798, 30734578, 48479188, 75277670, 115195490, 173885716, 259140928, 381577586, 555546058, 800247348, 1141190188, 1611961716, 2256500525, 3131834205, 4311542748, 5889896410, 7987022942, 10755035190, 14385595262, 19118822650, 25254176312, 33163189812, 43304881124, 56243680664, 72670939174, 93429813408, 119544886506, 152256267306, 193059884115, 243753651611, 306491663644, 383846008918, 478878888344, 595224536168, 737184249518, 909833915122, 1119148085092, 1372139852928, 1677021463926, 2043384753160, 2482407378168, 3007083753976, 3632487869844, 4376066674472, 5257972619331, 6301433795875, 7533171884668, 8983866061636, 10688674964170, 12687814521984, 15027205920330, 17759191117096, 20943332653076, 24647294738384, 28947825181142, 33931834634658, 39697595942280, 46356059489790, 54032310976830, 62867166875830, 73018938103277, 84665356438965, 98005698850568, 113263103445638, 130687117401934, 150556469684942, 173182114733688} |
|