(No) Primes in the CF Convergents of Sqrt(5)

Conjecture? Or con?

Brief Background Overview

Don't ask why, I was looking at the convergents of sqrt(23) (blame Dr. Heath-Brown), and for no good reason at all I just wondered whether primes were dotted throughout them or not:

apply((x)->if(ispseudoprime(x),x,0),contfracpnqn(contfrac(sqrt(23)),99999))
      %17 =
      [0 5 19 0 211 0 0 1151 0 0 0 0 0 0 0 0 0 0 101170579 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 536123334577939 0 0 0 0 0 0 0 0 0 0]

      [0 0 0 5 0 0 191 0 2111 2351 0 0 0 112799 0 0 4859521 0 0 0 0 259663249 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

Nothing to see here. But why 23? Ask Roger! I wonder if other numbers have any interesting properties amongst their convergents...

apply((x)->if(ispseudoprime(x),x,0),contfracpnqn(contfrac(sqrt(2)),99999))
      %18 =
      [0 3 7 17 41 0 239 577 0 0 0 0 0 0 0 665857 0 0 9369319 0 0 0 0 0 0 0 0 0 63018038201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 489133282872437279 0 0 0 0]

      [0 2 5 0 29 0 0 0 0 0 5741 0 33461 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 44560482149 0 0 0 0 0 0 0 0 0 0 0 1746860020068409 0 0 0 0 0 0 0 0 0 0]

Yup, nothing special...

apply((x)->if(ispseudoprime(x),x,0),contfracpnqn(contfrac(sqrt(3)),99999))
      %19 =
      [0 2 5 7 19 0 71 97 0 0 0 0 3691 0 0 0 0 0 191861 0 0 0 0 0 0 0 0 0 138907099 0 0 708158977 0 0 0 0 26947261171 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

      [0 0 3 0 11 0 41 0 0 0 571 0 2131 0 0 0 0 0 110771 0 0 0 1542841 0 0 0 0 0 0 0 0 0 0 0 0 0 15558008491 0 0 0 0 0 808717138331 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

Snore... is this going anywhere, Phil?!

apply((x)->if(ispseudoprime(x),x,0),contfracpnqn(contfrac(sqrt(5)),99999))
      %20 =
      [2 0  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

      [0 0 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

Waaaaat!??!??!?!?! Are 2 and 17 the *only* primes in these sequences?

There's got to be something going on...

Let's Investigate...

Clearly, these sequences are OEIS:A001077 Numerators and OEIS:A001076 Denominators of continued fraction convergents to sqrt(5).

Every time I see something lacking primes, I go in search of algebraic relations between terms and/or a covering set.

The Numerators

For the numerators, from the OEIS link:

A001077(n) = ((2 + sqrt(5))^n + (2 - sqrt(5))^n)/2
which is a sum of powers, so has cyclotomic factors, therefore Ni | Noi for all odd o, and therefore the only possible primes terms are N2n. Immediately, this makes the probability of there being any primes further down the sequence low, as the numbers grow exponentially. However, it seem (Stargate38's post on Mersenne Forums) that N217 = Lucas(3*217)/2, therefore, it's divisible by Lucas(217). Assuming this relation holds for all the other terms, they must all be composite.

Conjecture (that 2's the only prime): Proven.

The Denominators

For the denominators, from the OEIS link:

A001076(n) = a(n) = ((2+sqrt(5))^n - (2-sqrt(5))^n)/(2*sqrt(5))
which is a difference of powers, so has cyclotomic factors, therefore Ni | Nmi for all m, and therefore the only possible primes terms are Np for prime p. Obviously, this thins out the opportunities for primes, but not by an enormous factor; it's a density decay similar to that of Mersenne Primes, and they are conjectured to be infinite. However, it's time for some maths...

Dr. Sardonicus on Mersenne Forums points out that because the Fib/Lucas numbers satisfy Ln2 - 5·Fn2 = 4 · (-1)n And the CF convergents I'm looking at satisfy x2 - 5·y2 = &pminus;1 Then my convergents will correspond to both-even L/F pairs, which are the terms with 3|n. And because of L/F divisibility rules, that means they're definitially composite, apart from trivial small prime cases. Thus proving the assumption made above.

Conjecture (that 17's the only prime): Proven.

Auxiliary Guff

Before I asked on Mersenne Forums, I was just trying to gather data to try and detect patterns, and did a bunch of gmp-ecm runs. Here's the data I accumulated. It's a subset of the known Lucas/Fib factorisations, and more annoyingly two substreams of that data interleaved (due to the now-known divisibility properties), it's not particularly useful. Use FactorDB instead - it knows every factor of all these numbers, and more. However, it's left here as a testament to how amazing GMP-ECM is - these were almost all found in just a single day. (After some prep-work in Pari/GP - also amazing software.

? A001077(n)=([4,1;1,0]^n*[1;-2])[1,1]
      (n)->([4,1;1,0]^n*[1;-2])[1,1]
n 2n N2n Small Factorscofactor
0122
1293 * 3
241617 * 23
385184147 * 1103
416 5374978561 769 * 2207 * 3167
532 57780789062419261441 1087 * 4481 * 11862575248703
664 6677239169351578707225356193679818792961 127 * 383 * 5662847 * 6803327 * 19073614849 * 186812208641
7128 8917104584…1966295041 (80 digits) 119809 * 885503 * 1359361 * 1769526527 * 4698167634523379875583 * 74374487830388825730162393840383
8256 1590295083…6522383361 (161 digits) 34303 * 73327699969 * 192419633663 * 125960894984050328038716298487435392001 * P96=2608509536…6995717121
9512 5058076905…5699312641 (321 digits) 12289 * 21503 * 36922367 * 233860158486529 * 121293904579583 * 455666699738584063 * 1019850606646830767915009 * 13886785053860962490729330689 C207=2832040858…1955857409
101024 5116828396…9724789761 (642 digits) 6143 * 19243009 * 85386449571091580927 * 2359309429082740633601 C590=2148688675…4066060289
112048 5236386568…1300874241 (1284 digits) 234602220005904383 C1267=2232027714…00134627327
124096 5236386568…1300874241 (2568 digits) 12042241 * 65241089 * 113993809921 * 5267802182934527 C2527=1162396123…8486867967
138096 6014739017…7963939841 (5136 digits) 45503426740223 * 559819972888363009 C5103=2361153901…8689035263
1416384 7235417089…2134210561 2860793954303 C10244=7106495423…99229155327
1532768 1047025209…7367869441 (20545 digits) 2878401282049 C20531=3637523425…7432619009
1665536 2192523576…9243304961 (41089 digits) 107705794561 C41078=2035659813…8305126401
17131072 9614319269…4094423041 (82177 digits) 2749553154323378809339903 C82153=3496684272…5268789247

Credits: P25(17) Paul Leyland; most of the rest on inz's machine.

A001076(n)=([4,1;1,0]^n)[1,2]
forprime(p=2,500,a=A001076(p);f=factorint(a,if(p>150,15,8))~;bf=f[1,#f];c=if(ispseudoprime(bf),0,f[1,#f]=Strprintf("C%d",ceil(log(bf)/log(10)));bf);print(p" "f[1,]);if(c,write("dcomps",c" // "p)))
psmall factorscofactor
22 * 2
317
55 * 61
713 * 421
1189 * 19801
13233 * 135721
171597 * 6376021
1937 * 113 * 797 * 54833
23137 * 829 * 18077 * 28657
29173 * 514229 * 3821263937
31557 * 2417 * 4531100550901
3773 * 149 * 2221 * 1459000305513721
412789 * 59369 * 68541957733949701
43257 * 5417 * 8513 * 39639893 * 433494437
47108289 * 1435097 * 142017737 * 2971215073
53317 * 953 * 55945741 * 97639037 * 229602768949
59353 * 2191261 * 805134061 * 1297027681 * 2710260697
611097 * 4513 * 555003497 * 14297347971975757800833
67269 * 116849 * 1429913 * 5050260704396247169315999021
711277 * 6673 * 46165371073 * 185790722054921374395775013
73123953 * 4139537 * 9375829 * 86020717 * 3169251245945843761
79157 * 1668481 * 40762577 * 92180471494753 * 7698999052751136773
831033043205255409 * 99194853094755497 * 23812215284009787769
891069 * 122887425153289 * 1665088321800481 * 64455877349703042877309
97193 * 389 * 3084989 * 361040209 * 76674415738994499773 * 227993117754975870677
101743519377 * 770857978613 * 8550224389674481 * 96049657917279874851369421
103617 * 318889 * 519121 * 5644193 * 512119709 * 32386142297 * 883364563627459323040861
1071247833 * 8242065050061761 * 264438702655226193752458581121055151414928921
109653 * 1746181 * 827728777 * 32529675488417 * 1589546141427272679433846364366380457
113677 * 149161 * 258317 * 272602401466814027129 * 2209878650579776888742215348691420033
12727941 * 18995897 * 5568053048227732210073 * 3185450213669826966828420712039093359617657693
1312006657 * 1066340417491710595814572169 * 1416637080946563927978520983870724423060828193993
1375449861 * 972663078773 * 5687182485808243129 * 30362561855982035333 * 19134702400093278081449423917
139277 * 9173 * 2114537501 * 85526722937689093 * 683947238399029925033711768294717540495219762245783337
14946489 * 110557 * 162709 * 4000949 * 85607646594577 * 2041439879348543749772391551430740910004881655249657303909
1515737 * 2811666624525811646469915877 * 650485110124585564207518444489238632181884291012150730878874501
157313 * 11617 * 9947521 * 7636481 * 10424204306491346737 * 40729012583008994401 * 516975898656776821074144595127483817001
163977 * 4892609 * 33365519393 * 32566223208133 * 55010483350408487052485570744297 * 1226013535493914575737104535462481893
16718104700793 * 1966344318693345608565721 * 9024686010889754273 * 351082956611639069560238479712041302626479716454577
1736229 * 1174427453 * 1639343785721 * 3231124141939501 * 389678749007629271532733 * 43161383894452590546002225010382867863046433
17911813 * 21481 * 156089 * 142240444249423907190721 * 3418816640903898929534613769 * 195506819119444628118393349617623701189123224437
1818689 * 35837 * 6799178680013 * 8175789237238547574551461093 * 3903786629336559916994727361478951795388816198164294786919716213
1912670181 * 4870723671313 * 4817807925924421C85=20064..52793
1939465278929 * 28163700810443011860841849 C85
1974729 * 15761 * 25795969 * 227150265697 * 22221540969737 * 717185107125886549 * 6556208367360005292317 * 15918569172424565344075680728122279296922081
199397 * 1193 * 55092353 * 1226244816494972899766403949C84=40738..39473
211155717 * 22504837 * 38490197 * 800972881 * 80475423858449593021 * 192347474285460831200493920089 * 668360360027354504580730486579217 C
2234013 * 13381 * 108377 * 46871477 * 251534189 * 524888033 * 404275734463249277 * 164344610046410138896156070813 * 6071779617117999594835757254262106185322243030667128113
22723609 * 208109513 * 17505440236343865677 * 7915192391491235383593622394399717 C76
229457 * 1373 * 2749 * 40487201 * 3331306969 * 132605449901 * 47831560297620361798553 C83
233139801 * 13953397457 * 245701220509 * 25047390419633 * 631484089583693149557829547141 * 3565521683196754943245655497577124992129207006684416683019466576624709676217
2391433 * 10037 * 62141 * 7099733 * 2228536579597318057 * 15634731455464012955341 * 28546908862296149233369 * 24744769393544307608538320116459769387863284642832131983839761933049
24111042621 * 7005329677 * 5303337419059397 C118=68312..53909
25112049 * 221903616003409 * 582416774750273 * 587844315337792746053 C103=56959..36381
2575653 * 32971978671645905645521 * 131406574060578461239162302695445475836387075292244225875411667043425866999612408580365008680009889019290421
2634733 * 93629 * 8175789237238547574551461093 * 3903786629336559916994727361478951795388816198164294786919716213
2691613 * 3229 * 5381 * 114593 * 2517975182669813 * 32170944747810641 * 169360439829648789853 C101
27111429153 * 2117130049 * 5688689453 * 449187076348273 C129
27747877233 * 1454976293 * 46878833122606699500317 * 505471005740691524853293621 * 6861121308187330908986328104917 * 920790754055544137238372083272039729500210643185352207623351838
281174221 * 119468273 * 466269593837 * 2576582465657 * 818303948755277 * 2385377797192381 C108=68795..25529
2831697 * 10753 * 825229 * 15791401 * 179068261321 C146=14150..55173
2933383288581 * 64390759997 * 15342452091961 C150=33540..06249
3079143689 * 5307027867738937 * 3961793656824010600647617 * 6927250173726731623520538349 * 255070411941335685950739745685341 * 216913841513988014390392583520681471857 * 2017714677517624086655835261687632870253

#include <stdfooter.h>