2016年11月20日日曜日

161120

Ruby


y^2 + y = x^3 - x 上の有理点

P = (0, 0),
2P = (1, 0),
3P = (-1, -1),
4P = (2, -3),

を出力してみた。

# (a, b)が曲線上に存在するか?
def f(a, b)
  b * b + b == a * a * a - a
end

# A028940 / A028941, -A028942 / A028943
def A(n)
  p [1, [0, 0], f(0, 0)]
  a, b = 1r, 0r
  (2..n).each{|i|
    p [i, [a, b], f(a, b)]
    c = (b * b - a * a * a) / (a * a)
    d = -1 - b * c / a
    a, b = c, d
  }
end

n = 50
A(n)

出力結果
[1, [0, 0], true]
[2, [(1/1), (0/1)], true]
[3, [(-1/1), (-1/1)], true]
[4, [(2/1), (-3/1)], true]
[5, [(1/4), (-5/8)], true]
[6, [(6/1), (14/1)], true]
[7, [(-5/9), (8/27)], true]
[8, [(21/25), (-69/125)], true]
[9, [(-20/49), (-435/343)], true]
[10, [(161/16), (-2065/64)], true]
[11, [(116/529), (-3612/12167)], true]
[12, [(1357/841), (28888/24389)], true]
[13, [(-3741/3481), (-43355/205379)], true]
[14, [(18526/16641), (-2616119/2146689)], true]
[15, [(8385/98596), (-28076979/30959144)], true]
[16, [(480106/4225), (332513754/274625)], true]
[17, [(-239785/2337841), (331948240/3574558889)], true]
[18, [(12551561/13608721), (-8280062505/50202571769)], true]
[19, [(-59997896/67387681), (-641260644409/553185473329)], true]
[20, [(683916417/264517696), (-18784454671297/4302115807744)], true]
[21, [(1849037896/6941055969), (-318128427505160/578280195945297)], true]
[22, [(51678803961/12925188721), (10663732503571536/1469451780501769)], true]
[23, [(-270896443865/384768368209), (66316334575107447/238670664494938073)], true]
[24, [(4881674119706/5677664356225), (-8938035295591025771/13528653463047586625)], true]
[25, [(-16683000076735/61935294530404), (-588310630753491921045/487424450554237378792)], true]
[26, [(997454379905326/49020596163841), (-31636113722016288336230/343216282443844010111)], true]
[27, [(2786836257692691/16063784753682169), (-435912379274109872312968/2035972062206737347698803)], true]
[28, [(213822353304561757/158432514799144041), (41974401721854929811774227/63061816101171948456692661)], true]
[29, [(-3148929681285740316/2846153597907293521), (-2181616293371330311419201915/4801616835579099275862827431)], true]
[30, [(79799551268268089761/62586636021357187216), (-754388827236735824355996347601/495133617181351428873673516736)], true]
[31, [(342115756927607927420/2237394491744632911601), (-86493818646310922606526774743956/105831230775844387744754441796151)], true]
[32, [(53139223644814624290821/1870098771536627436025), (12201668323950325956888219182513256/80871745605559864852893980186125)], true]
[33, [(-280251129922563291422645/1262082793174195430038441), (253863219659861232674408424330433645/1417854835344178787714550500916300011)], true]
[34, [(36631192030206080565822006/41998153797159031581158401), (-80758747641526362425597637684850206815/272173162387524688124210116071636697601)], true]
[35, [(-804287518035141565236193151/1063198259901027900600665796), (-43588991327163432486545613110592404899171/34667409118422632032070193604742966179656)], true]
[36, [(54202648602164057575419038802/15402543997324146892198790401), (-13092420486726785928582676734341299347115698/1911563313687376346904659714182809942964351)], true]
[37, [(743043134297049053529252783151/2763291877248901877407461697249), (-2189483446304543061371288657290348890980594400/4593462133720075853302175244236393876880522193)], true]
[38, [(102993803538933982914320107718801/35845578465602823663322959338401), (878446167724531925433595104275654803292506071599/214611697633277024760852115267283591567237967601)], true]
[39, [(-3239336802390544740129153150480400/3838799532815709794201672388387649), (48072547288390781193922630252285326406309975292943/237844520166539043234240287233775865292113468549857)], true]
[40, [(263817293110494867593838666854208001/292736325329248127651484680640160000), (-124196438988982893632369913491756562921318307752469249/158385319626308443937475969221994173751192384064000000)], true]
[41, [(-2613390252458014344369424012613679600/18130554499963269207328264658003398849), (-86882155212892274588612983069418029552410839095153302800/77199880835273348763199754318716659251711787046519688993)], true]
[42, [(1425604881483182848970780090473397497201/23330922815816934561924264996456917601), (-53875991960104970765283107373605344809310387645985049959200/112693242618274179956651080434126947419217320185504463599)], true]
[43, [(12518737094671239826683031943583152550351/112095263170952502579054676954803745129249), (-4736963419597991005921784696415662858882109120520022240208657/37530201088428893504297348999259274784075840220078303129323057)], true]
[44, [(7829698846539503638114853800715638513953202/6717213017363033576059307226857689370745601), (5524905488265614668992892434873748844920757678725926478259255853/17409395093926185106885631047952575457813864890094033864975902849)], true]
[45, [(-596929565407758846078157850477988229836340351/546893617922188211588396787764926990139280196), (-8988854703297735806987625854273224398026564032032776384182186736165/12789521106940379462098473081947860361167209079884962192477681132744)], true]
[46, [(79894464813428119450058959276433565868597634006/53046539559910784267590065399289562705929497601), (-24066410114833357599838577779951121277275124199036386947622283276346814/12217591143721452560613778332455777842477669131611512703021731989593599)], true]
[47, [(2385858586329829631608077553938139264431352010155/11671603578179426152483616311075870788715631720041), (-29214087094205221480230038284783574921809176572474206696449157526076526744/39874549799038515744164859874198500898417335456037004381292650442289963339)], true]
[48, [(1356533706384096591887827693333962338847777347485221/107308058945765220809811860660656614527354467284025), (49253432232175037853939274934357858897623864482230655849646172771417862103019/1111599924813736177345961430101881701789905659558155903791530971080388326125)], true]
[49, [(-56186054018434753527022752382280291882048809582857380/157663313719502807884874799318714943425831988660626801), (15592711215337616623740514518966145859285850662560621449737978910137952277603645/62603119606309056626706148210887786481951193818503864231982726681629376131719799)], true]
[50, [(24854671723753819921380822649312751965653209957505606561/29418784545883822188243570198416287437001335203340988816), (-65343698144990446428357439135977881124804221113554492507243553294512904673973173265/159564798621271700005828929931002008441744804573070282618997694000714045237979692864)], true]

0 件のコメント:

コメントを投稿

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