login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A205323
Least prime p>3 such that 2^n + p*2^k - 1 and 2^n + p*2^k + 1 are twin primes for some k with n/3 < k < n+1.
2
5, 7, 13, 7, 5, 11, 7, 7, 5, 13, 5, 11, 7, 13, 13, 11, 5, 11, 13, 7, 23, 41, 19, 11, 5, 17, 17, 79, 13, 43, 7, 19, 13, 13, 13, 43, 67, 7, 13, 43, 31, 11, 113, 7, 5, 13, 59, 11, 5, 83, 19, 37, 7, 113, 29, 19, 23, 41, 97, 53, 79, 13, 29, 7, 5, 41, 19, 13, 11
OFFSET
1,1
EXAMPLE
2^1+5*2^1-1=11 11 and 13 twin primes so a(1)=5.
2^2+7*2^1-1=17 17 and 19 twin primes so a(2)=7.
2^3+13*2^2-1=59 59 and 61 twin primes so a(3)=13.
PROG
PFGW64 from Primeform group and SCRIPTIFY
SCRIPT
DIM nn, 0
DIM mm
DIM kk
DIMS tt
OPENFILEOUT myfile, twins.txt
LABEL loopn
SET nn, nn+1
IF nn>2000 THEN END
SET kk, 2
LABEL loopk
SET kk, kk+1
SET mm, nn/3
LABEL loopm
SET mm, mm+1
IF mm>nn THEN GOTO loopk
SETS tt, %d, %d, %d, %d\ ; nn; kk; p(kk); mm
PRP 2^nn+p(kk)*2^mm-1, tt
IF ISPRIME THEN GOTO a
IF ISPRP THEN GOTO a
GOTO loopm
LABEL a
PRP 2^nn+p(kk)*2^mm+1, tt
IF ISPRIME THEN GOTO b
IF ISPRP THEN GOTO b
GOTO loopm
LABEL b
WRITE myfile, tt
GOTO loopn
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jan 26 2012
STATUS
approved