%I #41 Aug 12 2023 11:22:58
%S 1,1,1,13,13,608,4094,1875397,143639306,5613099946,20207317759,
%T 1474035260669
%N a(n) is the smallest prefix such that the numbers with k digits "9" appended are primes for k = 1, 2, ..., n.
%C See A186069 for the digit "3" case. The corresponding sequences with the digits "1" or "7" are not possible because if nX and nXX are prime, then nXXX will be a multiple of 3 when X is 1 or 7.
%C 323399992 is prime if you add up to eight "9"s to it. This one is noteworthy since it contains a string of four "9"s to begin with. It also only contains three unique digits. - _Jonathan Pappas_, Oct 13 2021
%C Any term after a(7) is congruent to 6 (mod 7). - _Jonathan Pappas_, Oct 19 2021
%C When a'(n) is the smallest prefix as in the Name but not for k = n+1, then the data becomes: 2, 5, 1, 104, 13, 608, 4094, ... In this case, a'(2) = 5 because 59 and 599 are primes while 5999 = 7*857. - _Bernard Schott_, Nov 19 2021
%e a(6) = 608 because 6089, 60899, 608999, 6089999, 60899999 and 608999999 are primes.
%p with(numtheory): for n from 1 to 10 do: idd:=0:for k from 1 to 1000000 while(idd=0)
%p do:a0:=k:id:=0:ite:=0:for u from 1 to n do:a1:=a0*10+9:if type(a1,prime)=true
%p then ite:=ite+1:a0:=a1:else fi:od:if ite =n then idd:=1:print(k):else fi:od:od:
%t m=1; Table[While[d=IntegerDigits[m]; k=0; While[k++; AppendTo[d, 9]; k <= n
%t && PrimeQ[FromDigits[d]]]; k <= n, m++]; m, {n, 8}]
%o (PARI) isok(k, n) = my(sj=Str(k)); for(j=1, n, if (!isprime(eval(sj=concat(sj, Str(9)))), return(0))); return(1);
%o a(n) = my(k=1); while (!isok(k,n), k++); k; \\ _Michel Marcus_, Oct 18 2021
%o (Python)
%o from sympy import isprime
%o def a(n):
%o prefix = 1
%o while not all(isprime(int(str(prefix) + "9"*k)) for k in range(1, n+1)):
%o prefix += 1
%o return prefix
%o print([a(n) for n in range(1, 9)]) # _Michael S. Branicky_, Nov 19 2021
%Y Cf. A185682, A185684, A185685, A185687, A186069.
%K nonn,base,hard,more
%O 1,4
%A _Michel Lagneau_, Feb 11 2011
%E a(9) from _Jonathan Pappas_, Oct 13 2021
%E a(10)-a(11) from _Jonathan Pappas_, Oct 19 2021
%E a(12) from _Jonathan Pappas_, July 13 2023