All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Does it continue? 4: Euclid's next prime (Posted on 2017-09-21) Difficulty: 3 of 5
Before trying the problem "note your opinion as to whether the observed pattern is known to continue, known not to continue, or not known at all."

Let P(n)= The product of the first n primes.

P(n)+1 is like Euclid's method to show there are infinitely many primes, and may or not be prime itself. Now look at the difference between P(n) and the next prime after P(n)+1.

n=1, 5-(2)=3
n=2, 11-(2x3)=5
n=3, 37-(2x3x5)=7
n=4, 223-(2x3x5x7)=13
n=5, 2333-(2x3x5x7x11)=23
n=6, 30047-(2x3x5x7x11x13)=17
n=7, 510529-(2x3x5x7x11x13x17)=19
n=8, 9699713-(2x3x5x7x11x13x17x19)=23

Are these differences always prime?

No Solution Yet Submitted by Jer    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts Initial thought and computer exploration | Comment 1 of 3
Offhand I would not see any reason for this to be the case, but the program below fails to find a counterexample all the way through n=72.

    5   open "euclnxpr.txt" for output as #2
   10   N=1:Prod=2:P=2
   20   repeat
   30      inc N:P=nxtprm(P):Prod=Prod*P:Nout=N
   40      Nx=fnNxprime(Prod+2)
   50      if fnPrime(Nx-Prod)<>1 then print N,Nx,Prod,Nx-Prod,fnPrime(Nx-Prod)
   51      print #2,N,Nx,Prod,Nx-Prod,fnPrime(Nx-Prod)
   60   until N>71
   70   close #2
 9999   end
10000   fnOddfact(N)
10010   local K=0,P
10030   while N@2=0
10040     N=N
10050     K=K+1
10060   wend
10070   P=pack(N,K)
10080   return(P)
10090   '
10100   fnPrime(N)
10110   local I,X,J,Y,Q,K,T,Ans
10120   if N@2=0 then Ans=0:goto *EndPrime
10125   O=fnOddfact(N-1)
10130   Q=member(O,1)
10140   K=member(O,2)
10150   I=0
10160   repeat
10170     repeat
10180       X=fnLrand(N)
10190     until X>1
10200     J=0
10210     Y=modpow(X,Q,N)
10220     loop
10230       if or{and{J=0,Y=1},Y=N-1} then goto *ProbPrime
10240       if and{J>0,Y=1} then goto *NotPrime
10250       J=J+1
10260       if J=K then goto *NotPrime
10270       Y=(Y*Y)@N
10280     endloop
10290    *ProbPrime
10300     I=I+1
10310   until I>50
10320   Ans=1
10330   goto *EndPrime
10340   *NotPrime
10350   Ans=0
10360   *EndPrime
10370   return(Ans)
10380   '
10400   fnLrand(N)
10410   local R
10415   N=int(N)
10420   R=(int(rnd*10^(alen(N)+2)))@N
10430   return(R)
10440   '
10500   fnNxprime(X)
10510   if X@2=0 then X=X+1
10520   while fnPrime(X)=0
10530     X=X+2
10540   wend
10550   return(X)
10560   '

finds only primes through the time it was manually stopped at n = 72.

The figures are:

n   next  product  difference  1 indicates
    prime                      it is prime

 2   11   6   5   1 
 3   37   30   7   1 
 4   223   210   13   1 
 5   2333   2310   23   1 
 6   30047   30030   17   1 
 7   510529   510510   19   1 
 8   9699713   9699690   23   1 
 9   223092907   223092870   37   1 
 10   6469693291   6469693230   61   1 
 11   200560490197   200560490130   67   1 
 12   7420738134871   7420738134810   61   1 
 13   304250263527281   304250263527210   71   1 
 14   13082761331670077   13082761331670030   47   1 
 15   614889782588491517   614889782588491410   107   1 
 16   32589158477190044789   32589158477190044730   59   1 
 17   1922760350154212639131   1922760350154212639070   61   1 
 18   117288381359406970983379   117288381359406970983270   109   1 
 19   7858321551080267055879179   7858321551080267055879090   89   1 
 20   557940830126698960967415493   557940830126698960967415390   103   1 
 21   40729680599249024150621323549   40729680599249024150621323470   79   1 
 22   3217644767340672907899084554281   3217644767340672907899084554130   151   1 
 23   267064515689275851355624017992987   267064515689275851355624017992790   197   1 
 24   23768741896345550770650537601358411   23768741896345550770650537601358310   101   1 
 25   2305567963945518424753102147331756173   2305567963945518424753102147331756070   103   1 
 26   232862364358497360900063316880507363303   232862364358497360900063316880507363070   233   1 
 27   23984823528925228172706521638692258396433   23984823528925228172706521638692258396210   223   1 
 28   2566376117594999414479597815340071648394597   2566376117594999414479597815340071648394470   127   1 
 29   279734996817854936178276161872067809674997453   279734996817854936178276161872067809674997230   223   1 
 30   31610054640417607788145206291543662493274687181   31610054640417607788145206291543662493274686990   191   1 
 31   4014476939333036189094441199026045136645885247893   4014476939333036189094441199026045136645885247730   163   1 
 32   525896479052627740771371797072411912900610967452859   525896479052627740771371797072411912900610967452630   229   1 
 33   72047817630210000485677936198920432067383702541010953   72047817630210000485677936198920432067383702541010310   643   1 
 34   10014646650599190067509233131649940057366334653200433329   10014646650599190067509233131649940057366334653200433090   239   1 
 35   1492182350939279320058875736615841068547583863326864530567   1492182350939279320058875736615841068547583863326864530410   157   1 
 36   225319534991831177328890236228992001350685163362356544092077   225319534991831177328890236228992001350685163362356544091910   167   1 
 37   35375166993717494840635767087951744212057570647889977422430309   35375166993717494840635767087951744212057570647889977422429870   439   1 
 38   5766152219975951659023630035336134306565384015606066319856069049   5766152219975951659023630035336134306565384015606066319856068810   239   1 
 39   962947420735983927056946215901134429196419130606213075415963491469   962947420735983927056946215901134429196419130606213075415963491270   199   1 
 40   166589903787325219380851695350896256250980509594874862046961683989901   166589903787325219380851695350896256250980509594874862046961683989710   191   1 
 41   29819592777931214269172453467810429868925511217482600306406141434158289   29819592777931214269172453467810429868925511217482600306406141434158090   199   1 
 42   5397346292805549782720214077673687806275517530364350655459511599582614673   5397346292805549782720214077673687806275517530364350655459511599582614290   383   1 
 43   1030893141925860008499560888835674370998623848299590975192766715520279329623   1030893141925860008499560888835674370998623848299590975192766715520279329390   233   1 
 44   198962376391690981640415251545285153602734402721821058212203976095413910573021   198962376391690981640415251545285153602734402721821058212203976095413910572270   751   1 
 45   39195588149163123383161804554421175259738677336198748467804183290796540382737503   39195588149163123383161804554421175259738677336198748467804183290796540382737190   313   1 
 46   7799922041683461553249199106329813876687996789903550945093032474868511536164701583   7799922041683461553249199106329813876687996789903550945093032474868511536164700810   773   1 
 47   1645783550795210387735581011435590727981167322669649249414629852197255934130751871517   1645783550795210387735581011435590727981167322669649249414629852197255934130751870910   607   1 
 48   367009731827331916465034565550136732339800312955331782619462457039988073311157667213243   367009731827331916465034565550136732339800312955331782619462457039988073311157667212930   313   1 
 49   83311209124804345037562846379881038241134671040860314654617977748077292641632790457335493   83311209124804345037562846379881038241134671040860314654617977748077292641632790457335110   383   1 
 50   19078266889580195013601891820992757757219839668357012055907516904309700014933909014729740483   19078266889580195013601891820992757757219839668357012055907516904309700014933909014729740190   293   1 
 51   4445236185272185438169240794291312557432222642727183809026451438704160103479600800432029464713   4445236185272185438169240794291312557432222642727183809026451438704160103479600800432029464270   443   1 
 52   1062411448280052319722448549835623701226301211611796930357321893850294264731624591303255041960861   1062411448280052319722448549835623701226301211611796930357321893850294264731624591303255041960530   331   1 
 53   256041159035492609053110100510385311995538591998443060216114576417920917800321526504084465112488013   256041159035492609053110100510385311995538591998443060216114576417920917800321526504084465112487730   283   1 
 54   64266330917908644872330635228106713310880186591609208114244758680898150367880703152525200743234420507   64266330917908644872330635228106713310880186591609208114244758680898150367880703152525200743234420230   277   1 
 55   16516447045902521732188973253623425320896207954043566485360902980990824644545340710198976591011245999381   16516447045902521732188973253623425320896207954043566485360902980990824644545340710198976591011245999110   271   1 
 56   4343825573072363215565699965702960859395702691913457985649917484000586881515424606782330843435957697766331   4343825573072363215565699965702960859395702691913457985649917484000586881515424606782330843435957697765930   401   1 
 57   1168489079156465704987173290774096471177444024124720198139827803196157871127649219224446996884272620699035477   1168489079156465704987173290774096471177444024124720198139827803196157871127649219224446996884272620699035170   307   1 
 58   316660540451402206051523961799780143689087330537799173695893334666158783075592938409825136155637880209438531401   316660540451402206051523961799780143689087330537799173695893334666158783075592938409825136155637880209438531070   331   1 
 59   87714969705038411076272137418539099801877190558970371113762453702525982911939243939521562715111692818014473106769   87714969705038411076272137418539099801877190558970371113762453702525982911939243939521562715111692818014473106390   379   1 
 60   24647906487115793512432470614609487044327490547070674282967249490409801198254927547005559122946385681862066942896081   24647906487115793512432470614609487044327490547070674282967249490409801198254927547005559122946385681862066942895590   491   1 
 61   6975357535853769564018389183934484833544679824821000822079731605785973739106144495802573231793827147966964944839452301   6975357535853769564018389183934484833544679824821000822079731605785973739106144495802573231793827147966964944839451970   331   1 
 62   2043779758005154482257388030892804056228591188672553240869361360495290305558100337270153956915591354354320728837959427521   2043779758005154482257388030892804056228591188672553240869361360495290305558100337270153956915591354354320728837959427210   311   1 
 63   627440385707582426053018125484090845262177494922473844946893937672054123806336803541937264773086545786776463753253544153867   627440385707582426053018125484090845262177494922473844946893937672054123806336803541937264773086545786776463753253544153470   397   1 
 64   195133959955058134502488637025552252876537200920889365778484014616008832503770745901542489344429915739687480227261852231729501   195133959955058134502488637025552252876537200920889365778484014616008832503770745901542489344429915739687480227261852231729170   331   1 
 65   61076929465933196099278943388997855150356143888238371488665496574810764573680243467182799164806563626522181311132959748531230563   61076929465933196099278943388997855150356143888238371488665496574810764573680243467182799164806563626522181311132959748531230210   353   1 
 66   19361386640700823163471425054312320082662897612571563761906962414215012369856637179096947335243680669607531475629148240284399976989   19361386640700823163471425054312320082662897612571563761906962414215012369856637179096947335243680669607531475629148240284399976570   419   1 
 67   6408618978071972467109041692977377947361419109761187605191204559105169094422546906281089567965658301640092918433248067534136392245091   6408618978071972467109041692977377947361419109761187605191204559105169094422546906281089567965658301640092918433248067534136392244670   421   1 
 68   2159704595610254721415747050533376368260798239989520222949435936418441984820398307416727184404426847652711313512004598759003964186454673   2159704595610254721415747050533376368260798239989520222949435936418441984820398307416727184404426847652711313512004598759003964186453790   883   1 
 69   749417494676758388331264226535081599786496989276363517363454269937199368732678212673604332988336116135490825788665595769374375572699465677   749417494676758388331264226535081599786496989276363517363454269937199368732678212673604332988336116135490825788665595769374375572699465130   547   1 
 70   261546705642188677527611215060743478325487449257450867559845540208082579687704696223087912212929304531286298200244292923511657074872113331751   261546705642188677527611215060743478325487449257450867559845540208082579687704696223087912212929304531286298200244292923511657074872113330370   1381   1 
 71   92325987091692603167246758916442447848897069587880156248625475693453150629759757766750033011164044499544063264686235401999614947429856005621067   92325987091692603167246758916442447848897069587880156248625475693453150629759757766750033011164044499544063264686235401999614947429856005620610   457   1 
 72   33145029365917644537041586451002838777754047982048976093256545773949681076083753038263261851007891975336318712022358509317861766127318306017799447   33145029365917644537041586451002838777754047982048976093256545773949681076083753038263261851007891975336318712022358509317861766127318306017798990   457   1 


Edit: a version of the program has verified through n=135, and is continuing.

Edited on September 21, 2017, 4:47 pm


By now it has verified through 151, and I'm terminating the execution.

Edited on September 21, 2017, 7:20 pm
  Posted by Charlie on 2017-09-21 13:05:22

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (15)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information