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

A213886
Number of prime numbers of the form (10^k-j)*10^n-1 with 0<k<=2*n and 0<j<9.
2
7, 7, 11, 10, 15, 7, 10, 13, 19, 13, 10, 11, 9, 16, 10, 7, 10, 9, 15, 13, 17, 17, 18, 4, 10, 14, 7, 11, 8, 12, 16, 15, 18, 10, 17, 8, 12, 8, 6, 13, 7, 9, 15, 8, 12, 10, 18, 5, 3, 11, 18, 9, 18, 14, 10, 13, 15, 13, 12, 8, 11, 8, 10, 8
OFFSET
1,1
COMMENTS
The condition k<=2*n means we are setting an upper limit to the set of numbers to be checked given some n.
The condition 0<j<9 says we are only interested in near repdigit 9 primes, in practice only j = 1, 2, 4, 5, 7 or 8 seem to occur.
Statistics of entries over the range n=1 to 1000: all a(n) are > 0, with a minimum of 3 and a maximum of 27. The average of the a(n) is 12.
EXAMPLE
a(1)=7 counts 89, 79, 59, 29, 19, 929 and 919.
a(2)=7 counts 599, 499, 199, 9199, 999599, 999499 and 999199.
MAPLE
A213886 := proc(n)
local a, k, j;
a := 0 ;
for k from 1 to 2*n do
for j from 1 to 8 do
if isprime((10^k-j)*10^n-1) then
a := a+1 ;
end if;
end do:
end do:
return a;
end proc: # R. J. Mathar, Jul 19 2012
PROG
(PFGW64 and SCRIPTIFY)
SCRIPT
DIM nn, 0
DIM kk
DIM jj
DIM cc, 0
DIMS tt
OPENFILEOUT myfile, a(n).txt
LABEL loopn
SET nn, nn+1
IF nn>1000 THEN END
SET cc, 0
SET kk, 0
LABEL loopk
SET kk, kk+1
IF kk>2*nn THEN GOTO a
SET jj, 9
LABEL loopj
SET jj, jj-1
IF jj%3==0 THEN SET jj, jj-1
IF jj<0 THEN GOTO loopk
SETS tt, %d, %d\,; nn; cc
PRP (10^kk-jj)*10^nn-1, tt
IF ISPRP THEN SET cc, cc+1
IF ISPRIME THEN SET cc, cc+1
GOTO loopj
LABEL a
WRITE myfile, tt
GOTO loopn
CROSSREFS
Sequence in context: A084513 A084523 A336019 * A053673 A204910 A152672
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jul 10 2012
STATUS
approved