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”).

A212037
The size of the set of numbers k>=0 such that all (2^n+k)*2^n-1 are prime but only the last (largest) (2^n+k)*2^n+1 is also an associated twin prime.
6
1, 6, 1, 4, 2, 2, 2, 24, 6, 2, 28, 7, 16, 47, 29, 6, 41, 16, 3, 17, 32, 10, 10, 23, 14, 15, 52, 4, 13, 20, 23, 4, 84, 26, 88, 50, 20, 35, 51, 44, 41, 87, 1, 142, 13, 188, 107, 162, 91, 96, 197, 4, 148, 71, 9, 66, 97, 41, 10, 9, 152, 234, 48, 104, 144, 40, 18, 45, 52, 204, 21, 49, 51, 9, 102, 13, 31, 108, 88
OFFSET
1,2
COMMENTS
Starting at a count of zero, we consider for increasing k>=0 the pairs (2^n+k)*2^n+-1. If the smaller of these two numbers is prime, we increase the counter. If the larger of these two numbers is also prime, we admit the counter to the sequence. It is basically a measure of how many unsuccessful primality tests on the larger of the two numbers are done before it becomes a compatible twin prime.
Heuristically, the average of a(n)/n over n=1 to N tends to 1 as N increases.
LINKS
EXAMPLE
For n=2, the 6 pairs (19,21) at k=1, (23,25) at k=2, (31,33) at k=4, (43,45) at k=7, (47,49) at k=8 and (59,61) at k=11 are counted. The smaller of these must be a prime to be counted, and at k=11 also the larger (i.e., 61) becomes prime, which finishes the search.
MAPLE
A212037 := proc(n)
local a, k, p ;
a := 0 ;
for k from 0 do
p := (2^n+k)*2^n-1 ;
if isprime(p) then
a := a+1 ;
end if;
if isprime(p) and isprime(p+2) then
return a;
end if;
end do:
end proc: # R. J. Mathar, Jul 20 2012
PROG
(PFGW & SCRIPT)
SCRIPT
DIM nn, 0
DIM jj
DIM kk
DIMS tt
OPENFILEOUT myfile, a(n).txt
LABEL loopn
SET nn, nn+1
IF nn>825 THEN END
SET kk, -1
SET jj, 0
LABEL loopk
SET kk, kk+1
SETS tt, %d, %d\,; nn; kk
PRP (2^nn+kk)*2^nn-1, tt
IF ISPRP THEN GOTO a
IF ISPRIME THEN GOTO a
GOTO loopk
LABEL a
SET jj, jj+1
PRP (2^nn+kk)*2^nn+1, tt
IF ISPRP THEN GOTO d
IF ISPRIME THEN GOTO d
GOTO loopk
LABEL d
SETS tt, %d, %d\,; nn; jj
WRITE myfile, tt
GOTO loopn
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jul 14 2012
STATUS
approved