login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Number of prime numbers of the form (10^k-j)*10^n-1 with 0<k<=2*n and 0<j<9.
2

%I #14 Mar 08 2013 02:56:20

%S 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,

%T 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,

%U 9,18,14,10,13,15,13,12,8,11,8,10,8

%N Number of prime numbers of the form (10^k-j)*10^n-1 with 0<k<=2*n and 0<j<9.

%C The condition k<=2*n means we are setting an upper limit to the set of numbers to be checked given some n.

%C 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.

%C 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.

%H Pierre CAMI, <a href="/A213886/b213886.txt">Table of n, a(n) for n = 1..1000</a>

%e a(1)=7 counts 89, 79, 59, 29, 19, 929 and 919.

%e a(2)=7 counts 599, 499, 199, 9199, 999599, 999499 and 999199.

%p A213886 := proc(n)

%p local a,k,j;

%p a := 0 ;

%p for k from 1 to 2*n do

%p for j from 1 to 8 do

%p if isprime((10^k-j)*10^n-1) then

%p a := a+1 ;

%p end if;

%p end do:

%p end do:

%p return a;

%p end proc: # _R. J. Mathar_, Jul 19 2012

%o (PFGW64 and SCRIPTIFY)

%o SCRIPT

%o DIM nn,0

%o DIM kk

%o DIM jj

%o DIM cc,0

%o DIMS tt

%o OPENFILEOUT myfile,a(n).txt

%o LABEL loopn

%o SET nn,nn+1

%o IF nn>1000 THEN END

%o SET cc,0

%o SET kk,0

%o LABEL loopk

%o SET kk,kk+1

%o IF kk>2*nn THEN GOTO a

%o SET jj,9

%o LABEL loopj

%o SET jj,jj-1

%o IF jj%3==0 THEN SET jj,jj-1

%o IF jj<0 THEN GOTO loopk

%o SETS tt,%d,%d\,;nn;cc

%o PRP (10^kk-jj)*10^nn-1,tt

%o IF ISPRP THEN SET cc,cc+1

%o IF ISPRIME THEN SET cc,cc+1

%o GOTO loopj

%o LABEL a

%o WRITE myfile,tt

%o GOTO loopn

%Y Cf. A213885

%K nonn

%O 1,1

%A _Pierre CAMI_, Jul 10 2012