login
A186069
a(n) is the smallest prefix such that the numbers with k digits "3" appended are primes for k = 1..n.
4
1, 2, 2, 2, 2177, 16109, 1100318, 1315351, 74810500, 1130720467, 103273582897, 1587865798465
OFFSET
1,2
COMMENTS
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.
Any term after a(7) is congruent to 2 (mod 7). - Jonathan Pappas, Oct 17 2021
a(13) is greater than 3*10^12. - Jonathan Pappas, Oct 19 2021
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
EXAMPLE
a(4) = 2 because 23, 233, 2333, 23333 are primes and 133 is not a prime number.
MAPLE
with(numtheory): for n from 1 to 10 do: idd:=0:for k from 1 to 1000000 while(idd=0)
do:a0:=k:id:=0:ite:=0:for u from 1 to n do:a1:=a0*10+3:if type(a1, prime)=true
then ite:=ite+1:a0:=a1:else fi:od:if ite =n then idd:=1:print(k):else fi:od:od:
MATHEMATICA
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}]
PROG
(PARI) isok(k, n) = my(sj=Str(k)); for(j=1, n, if (!isprime(eval(sj=concat(sj, Str(3)))), return(0))); return(1);
a(n) = my(k=1); while (!isok(k, n), k++); k; \\ Michel Marcus, Oct 18 2021
(Python)
from sympy import isprime
def a(n):
prefix = 1
while not all(isprime(int(str(prefix) + "3"*k)) for k in range(1, n+1)):
prefix += 1
return prefix
print([a(n) for n in range(9)]) # Michael S. Branicky, Nov 18 2021
CROSSREFS
KEYWORD
nonn,base,hard,more
AUTHOR
Michel Lagneau, Feb 11 2011
EXTENSIONS
a(10)-a(12) from Jonathan Pappas, Oct 19 2021
STATUS
approved