[go: up one dir, main page]

login
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
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, 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, 3, 23, 11, 2, 2, 9, 3, 1, 5, 4, 1, 6, 3, 18, 2
OFFSET
1,9
COMMENTS
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.
Conjecture: there is always at least one (k,j) solution for each n.
EXAMPLE
Refers to the primes 89, 599, 8999, 79999, 799999, 4999999, 89999999,...
MAPLE
A213883 := proc(n)
for k from 1 to 2*n-1 do
for j from 0 to 9 do
if isprime( (10^k-j)*10^n-1) then
return k;
end if;
end do:
end do:
return 0 ;
end proc: # R. J. Mathar, Jul 20 2012
PROG
SCRIPT
DIM nn, 0
DIM jj
DIM kk
DIMS tt
OPENFILEOUT myfile, a(n).txt
LABEL loopn
SET nn, nn+1
IF nn>2200 THEN END
SET kk, 0
LABEL loopk
SET kk, kk+1
IF kk>2*nn THEN GOTO loopn
SET jj, 0
LABEL loopj
SET jj, jj+1
IF jj%3==0 THEN SET jj, jj+1
IF jj>9 THEN GOTO loopk
SETS tt, %d, %d, %d\,; nn; kk; jj
PRP (10^kk-jj)*10^nn-1, tt
IF ISPRP THEN GOTO a
IF ISPRIME THEN GOTO a
GOTO loopj
LABEL a
WRITE myfile, tt
GOTO loopn
CROSSREFS
Cf. A213790, A213884 (corresponding j).
Sequence in context: A230517 A165003 A165011 * A192190 A272729 A064034
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jun 26 2012
STATUS
approved