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!)
A213883 Least number k such that (10^k-j)*10^n-1 is prime for some single-digit j or 0 if no such prime with 1<=k, 0<=j<=9 exists. 4

%I #24 Jul 20 2012 15:22:14

%S 1,1,1,1,1,1,1,1,2,1,3,2,1,1,3,5,5,3,1,3,3,1,1,9,1,1,1,1,1,7,3,6,4,1,

%T 4,4,1,15,10,1,7,3,1,3,2,2,4,6,1,3,5,20,1,1,1,8,10,7,15,10,1,4,2,5,8,

%U 3,23,11,2,2,9,3,1,5,4,1,6,3,18,2

%N Least number k such that (10^k-j)*10^n-1 is prime for some single-digit j or 0 if no such prime with 1<=k, 0<=j<=9 exists.

%C j cannot be 0, 3, 6 or 9 because we are searching for repdigit primes with k-1 times the digit 9, one digit (9-j), and n least-significant digits 9 (so n+k-1 times the digit 9 in total). If j is a multiple of 3, that number is also a multiple of 3 and not prime.

%C Conjecture: there is always at least one (k,j) solution for each n.

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

%e Refers to the primes 89, 599, 8999, 79999, 799999, 4999999, 89999999,...

%p A213883 := proc(n)

%p for k from 1 to 2*n-1 do

%p for j from 0 to 9 do

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

%p return k;

%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. A213790, A213884 (corresponding j).

%K nonn

%O 1,9

%A _Pierre CAMI_, Jun 26 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 25 11:39 EDT 2024. Contains 371969 sequences. (Running on oeis4.)