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.
LINKS
Pierre CAMI, Table of n, a(n) for n = 1..1000
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
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jul 10 2012
STATUS
approved