cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A213883 #26 Jan 16 2025 11:52:05
%S A213883 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 A213883 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 A213883 3,23,11,2,2,9,3,1,5,4,1,6,3,18,2
%N 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.
%C A213883 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 A213883 Conjecture: there is always at least one (k,j) solution for each n.
%H A213883 Pierre CAMI, <a href="/A213883/b213883.txt">Table of n, a(n) for n = 1..2200</a>
%e A213883 Refers to the primes 89, 599, 8999, 79999, 799999, 4999999, 89999999,...
%p A213883 A213883 := proc(n)
%p A213883     for k from 1 to 2*n-1 do
%p A213883         for j from 0 to 9 do
%p A213883             if isprime( (10^k-j)*10^n-1) then
%p A213883                 return k;
%p A213883             end if;
%p A213883         end do:
%p A213883     end do:
%p A213883     return 0 ;
%p A213883 end proc: # _R. J. Mathar_, Jul 20 2012
%o A213883 (PFGW & SCRIPT)
%o A213883 SCRIPT
%o A213883 DIM nn,0
%o A213883 DIM jj
%o A213883 DIM kk
%o A213883 DIMS tt
%o A213883 OPENFILEOUT myfile,a(n).txt
%o A213883 LABEL loopn
%o A213883 SET nn,nn+1
%o A213883 IF nn>2200 THEN END
%o A213883 SET kk,0
%o A213883 LABEL loopk
%o A213883 SET kk,kk+1
%o A213883 IF kk>2*nn THEN GOTO loopn
%o A213883 SET jj,0
%o A213883 LABEL loopj
%o A213883 SET jj,jj+1
%o A213883 IF jj%3==0 THEN SET jj,jj+1
%o A213883 IF jj>9 THEN GOTO loopk
%o A213883 SETS tt,%d,%d,%d\,;nn;kk;jj
%o A213883 PRP (10^kk-jj)*10^nn-1,tt
%o A213883 IF ISPRP THEN GOTO a
%o A213883 IF ISPRIME THEN GOTO a
%o A213883 GOTO loopj
%o A213883 LABEL a
%o A213883 WRITE myfile,tt
%o A213883 GOTO loopn
%Y A213883 Cf. A213790, A213884 (corresponding j).
%K A213883 nonn
%O A213883 1,9
%A A213883 _Pierre CAMI_, Jun 26 2012