login
A350214
a(n) is the smallest suffix such that the numbers with k digits "3" prepended are primes for k = 1, 2, ..., n but not for k = n+1.
3
11, 7, 47, 923, 331, 31, 1, 26009371, 1233803717, 24680858269
OFFSET
1,1
COMMENTS
Variant of A186143 where the first 7 terms are equal to 1, then a(7) = A186143(7) = 1; also a(m) = A186143(m) for m = 8, 9, 10.
Unlike A186143, this sequence is not monotonic.
EXAMPLE
a(1) = 11 because 311 is prime while 3311 = 11 * 301, and 11 is the smallest number with this property.
a(2) = 7 because 37 and 337 are primes while 3337 = 47 * 71, and 7 is the smallest number with this property.
a(3) = 47 because 347, 3347 and 33347 are primes while 333347 = 7 * 7 * 6803, and 47 is the smallest number with this property.
PROG
(PARI) isok(k, n)= my(s=Str(k)); for (i=1, n, s = concat("3", s); if (!isprime(eval(s)), return(0))); return (!isprime(eval(concat("3", s))));
a(n) = my(k=1); while(! isok(k, n), k++); k; \\ Michel Marcus, Dec 20 2021
(Python)
from sympy import isprime
def a(n):
an = 0
while True:
an, k = an+1, 1
while isprime(int("3"*k+str(an))): k += 1
if k-1 == n: return an
print([a(n) for n in range(1, 8)]) # Michael S. Branicky, Dec 20 2021
CROSSREFS
KEYWORD
nonn,base,hard,more
AUTHOR
Bernard Schott, Dec 19 2021
EXTENSIONS
a(5)-a(10) from Michael S. Branicky, Dec 20 2021
STATUS
approved