ps (summary of twin-prime-yielding chains & another program)

Rick Shepherd R.Shepherd at prodigy.net
Thu Apr 11 00:34:27 CEST 2002


Thanks for the acknowledgment, Neil.  I'm glad you're including the PARI
program.  I see that the related A069176 is already in the database too.

Here are the actual chains yielded by primes previously mentioned (lesser of
twin primes given):
3
5 --> 11
211049 --> 422099 --> 844199
253679 --> 507359 --> 1014719 --> 2029439
41887255409 --> 83774510819 --> 167549021639 --> 335098043279 -->
670196086559

(Perhaps, although finite, some (long(er)) chains like these could go in as
separate sequences!?)

(Note that that last chain doesn't yield a 6th twin prime pair but that it
does yield the one prime 1340392173120+1)

There's a variation on the earlier PARI program that I was using to look for
least twin primes yielding different chain lengths.  It was running when
David Wilson provided the 41887255409 term.  His methods and/or machine are
clearly much faster than mine (or had been running much longer).  For anyone
who doesn't have a precalculated list of twin primes, the following could be
a useful starting point, too.  (Use it however you wish.).  It makes use of
the fact deduced about the congruence mod 30 to 29 of each of the lesser
twin primes in the chain.  (I thought this may improve speed by doing this
check prior to the isprime check ("ifs" are evaluated left-to-right in PARI
only until the logic result is clear) but am not so sure since I didn't do
actual timings and I was running two or three other programs at same time):

Here are some notes I made to myself earlier about PARI -- special start-up
is required to get millions of precalculated primes.  ** Note that even with
these extra primes, the program below would not have found the term David
did (or even gotten close). **  (As far as I know, PARI doesn't have
built-in precalculated twin primes):

{To start PARI with an increased primelimit (default is 500000, which allows
up to prime(41561), returning 500257) from an MS-DOS window:
Device:\directory\pari217 -p 1000000 (e.g.) allows up to prime(78519), which
returns 1000253.
-p 2000000 allows up to prime(148949), which returns 2000249.
-p 5000000 allows up to prime(348528), which returns 5000257.
-p 10000000 allows up to prime(664591), which returns 10000253.
-p 436270000 allows up to prime(23163162), which returns 436270213.

even with the value this "small" -p 436273000 causes:
"***   impossible to have prestored primes > 436273009."}

very ambitious vector size below (v[n] will contain first smaller twin prime
yielding chain of length n)

v=vector(50)
for(n=1,23163161,\
  if(n%100000==0,print("...",n));\
  if(prime(n)%30==29&&(prime(n+1)-prime(n)==2),\
   chain_length=1;\
   s=prime(n+1)+prime(n);\

   end_of_chain=0;\
   until(end_of_chain,if((s-1)%30==29&&isprime(s-1)&&isprime(s+1),\
    chain_length=chain_length+1;\
    s=2*s,\
    end_of_chain=1;\
    if(v[chain_length]==0,v[chain_length]=prime(n);\
     print("Chain Length = ",chain_length,", Starting Lesser Twin
Prime(",n,") = ",prime(n)))))));  v

...and some sample output...
Chain Length = 2, Starting Lesser Twin Prime(10) = 29 <==  We already knew
that 3 and 5 were first two;
Chain Length = 1, Starting Lesser Twin Prime(17) = 59 <==  so these are
first two congruent to 29 mod 30.
Chain Length = 3, Starting Lesser Twin Prime(18894) = 211049
Chain Length = 4, Starting Lesser Twin Prime(22332) = 253679

Regards,
Rick Shepherd

----- Original Message -----
From: Neil Fernandez <primeness at borve.demon.co.uk>
To: <seqfan at ext.jussieu.fr>
Cc: <R.Shepherd at prodigy.net>
Sent: Wednesday, April 10, 2002 1:08 PM
Subject: Re: ps


> In message <200204101532.LAA71936 at fry.research.att.com>, N. J. A. Sloane
> <njas at research.att.com> writes
> [...]
> >3 5 211049 253679 41887255409
> >
> >so, please send in that sequence!
>
> Done. Contributions by Rick, Don, and David acknowledged in the
> submission. Also included your PARI prog Rick, properly attributed -
> hope this is OK?
>
> Neil
> --
> Neil Fernandez






More information about the SeqFan mailing list