2017年4月23日日曜日

170423

Ruby


5/2

Clifford A. Pickover のA Passion for Mathematics に
以下の無限積が載っていた。
Product_{i>=1} (prime(i)^2 + 1)/(prime(i)^2 - 1) = 5/2
そこで、
Product_{i=1..n} (prime(i)^2 + 1)/(prime(i)^2 - 1) = Product_{i=1..n} (1 + 2/(prime(i)^2 - 1))
を計算してみた。

require 'prime'

n = 30
s = 1
Prime.take(n).each_with_index{|e, i| p [i + 1, s *= 1 + 2r / (e * e - 1)]}

出力結果
[1, (5/3)]
[2, (25/12)]
[3, (325/144)]
[4, (8125/3456)]
[5, (99125/41472)]
[6, (8425625/3483648)]
[7, (1221715625/501645312)]
[8, (44226105625/18059231232)]
[9, (11719917990625/4767637045248)]
[10, (986817094810625/400481511800832)]
[11, (94931804520782125/38446225132879872)]
[12, (65028286096735755625/26297217990889832448)]
[13, (10937757721470954096125/4417932622469491851264)]
[14, (10117425892360632538915625/4082169743161810470567936)]
[15, (11179755611058498955501765625/4506715396450638759507001344)]
[16, (1208273587195168540959998515625/486725262816668986026756145152)]
[17, (14507615967633023653871430453125/5840703153800027832321073741824)]
[18, (5399734663153011403970946414653125/2172741573213610353623439431958528)]
[19, (713082606986971211877339688288015625/286801887664196566678294005018525696)]
[20, (359536250442830885028554670834817478125/144548151382755069605860178529336950784)]
[21, (25896327227841738070299951291210502140625/10407466899558365011621932854112260456448)]
[22, (1243422111970677915652402276613353495090625/499558411178801520557852776997388501909504)]
[23, (104477784774121595595671362022756165624078125/41962906539019327726859633267780634160398336)]
[24, (82767301098059128030890852994427434407394690625/33234621978903307559672829548082262255035482112)]
[25, (389420151666368197385341463338781078886792019390625/156335661788761158760700990194178961647686907854848)]
[26, (4673958102706221587912063069390875960944767272733125/1876027941465133905128411882330147539772242894258176)]
[27, (112196143596635771601237532050310393542135703085290625/45024670595163213723081885175923540954533829462196224)]
[28, (12119300416806411177680846622415603830730696229496015625/4862664424277627082092843598999742423089653581917192192)]
[29, (14400152755249377761320381956754220471674213259887165765625/5776845336041820973526298195611693998630508455317624324096)]
[30, (91944975342267277006030638793875697711639851664379553413515625/36879380625290985094991887680785054487257165978747713685028864)]

0 件のコメント:

コメントを投稿

注: コメントを投稿できるのは、このブログのメンバーだけです。