%I #49 Nov 19 2021 12:02:43
%S 1,2,2,2,2177,16109,1100318,1315351,74810500,1130720467,103273582897,
%T 1587865798465
%N a(n) is the smallest prefix such that the numbers with k digits "3" appended are primes for k = 1..n.
%C See A186070 for the digit "9" 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 Any term after a(7) is congruent to 2 (mod 7). - _Jonathan Pappas_, Oct 17 2021
%C a(13) is greater than 3*10^12. - _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: 1, 26, 17, 2, 2177, 16109, ... In this case, a'(2) = 26 because 263 and 2633 are primes, while 26333 is divisible by 17. - _Bernard Schott_, Nov 18 2021
%e a(4) = 2 because 23, 233, 2333, 23333 are primes and 133 is not a prime number.
%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+3: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, 3]; k <= n && PrimeQ[FromDigits[d]]]; k <= n, m++]; m, {n, 6}]
%o (PARI) isok(k, n) = my(sj=Str(k)); for(j=1, n, if (!isprime(eval(sj=concat(sj, Str(3)))), 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) + "3"*k)) for k in range(1, n+1)):
%o prefix += 1
%o return prefix
%o print([a(n) for n in range(9)]) # _Michael S. Branicky_, Nov 18 2021
%Y Cf. A185682, A185684, A185685, A185687.
%K nonn,base,hard,more
%O 1,2
%A _Michel Lagneau_, Feb 11 2011
%E a(10)-a(12) from _Jonathan Pappas_, Oct 19 2021