login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A213884 For the smallest k >= 1, the smallest single-digit j such that (10^k-j)*10^n-1 is prime. 3

%I #23 Jul 20 2012 15:21:24

%S 1,4,1,2,2,5,1,2,1,2,1,4,4,5,5,1,4,7,1,4,2,4,4,1,2,8,7,4,1,1,2,1,1,4,

%T 7,4,1,1,7,4,8,2,7,4,8,8,7,2,2,1,8,2,8,5,7,1,8,4,8,1,4,1,4,7,1,2,8,2,

%U 4,1,4,8,4,5,8,2,1,2,7,7,5,1,4,8,7,4,1,4,2,2,4,5

%N For the smallest k >= 1, the smallest single-digit j such that (10^k-j)*10^n-1 is prime.

%C These j are the associated shifts to be paired with the k-values of A213883. There are no multiples of 3 here, as explained in A213883.

%C For the first 2200 values of n, there is always at least one pair (k,j) that delivers a prime with the conditions.

%H Pierre CAMI, <a href="/A213884/b213884.txt">Table of n, a(n) for n = 1..2200</a>

%e j=1 associated with the prime 89, j=4 associated with 599, j=1 associated with 8999, j=2 with 79999 are the first 4 entries.

%p A213884 := proc(n)

%p for k from 1 do

%p for j from 0 to 9 do

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

%p return j;

%p end if;

%p end do:

%p end do:

%p return 0 ;

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

%o SCRIPT

%o DIM nn, 0

%o DIM jj

%o DIM kk

%o DIMS tt

%o OPENFILEOUT myfile, a(n).txt

%o LABEL loopn

%o SET nn, nn+1

%o IF nn>2200 THEN END

%o SET kk, 0

%o LABEL loopk

%o SET kk, kk+1

%o IF kk>2*nn THEN GOTO loopn

%o SET jj, 0

%o LABEL loopj

%o SET jj, jj+1

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

%o IF jj>9 THEN GOTO loopk

%o SETS tt, %d, %d, %d\,; nn; kk; jj

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

%o IF ISPRP THEN GOTO a

%o IF ISPRIME THEN GOTO a

%o GOTO loopj

%o LABEL a

%o WRITE myfile, tt

%o GOTO loopn

%Y Cf. A213883.

%K nonn

%O 1,2

%A _Pierre CAMI_, Jun 29 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 03:00 EDT 2024. Contains 371917 sequences. (Running on oeis4.)