login
A186070
a(n) is the smallest prefix such that the numbers with k digits "9" appended are primes for k = 1, 2, ..., n.
4
1, 1, 1, 13, 13, 608, 4094, 1875397, 143639306, 5613099946, 20207317759, 1474035260669
OFFSET
1,4
COMMENTS
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.
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
Any term after a(7) is congruent to 6 (mod 7). - 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: 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
EXAMPLE
a(6) = 608 because 6089, 60899, 608999, 6089999, 60899999 and 608999999 are primes.
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+9: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, 9]; k <= n
&& PrimeQ[FromDigits[d]]]; k <= n, m++]; m, {n, 8}]
PROG
(PARI) isok(k, n) = my(sj=Str(k)); for(j=1, n, if (!isprime(eval(sj=concat(sj, Str(9)))), 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) + "9"*k)) for k in range(1, n+1)):
prefix += 1
return prefix
print([a(n) for n in range(1, 9)]) # Michael S. Branicky, Nov 19 2021
CROSSREFS
KEYWORD
nonn,base,hard,more
AUTHOR
Michel Lagneau, Feb 11 2011
EXTENSIONS
a(9) from Jonathan Pappas, Oct 13 2021
a(10)-a(11) from Jonathan Pappas, Oct 19 2021
a(12) from Jonathan Pappas, July 13 2023
STATUS
approved