login
A326398
a(n) is the smallest k > 0 such that the concatenation prime(n)k is composite.
1
1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1
OFFSET
1,2
COMMENTS
a(n) can only be 1 or 2 for any n >= 1. It appears that there are many more primes for which k = 1 than those for which k = 2 (~ 91% of the first 10^7 primes have k = 1).
LINKS
FORMULA
a(n) = 2 if prime(n) is in A023237, else a(n) = 1. [corrected by Chai Wah Wu, Jul 06 2020]
EXAMPLE
a(1) = 1 because 21 is prime, a(2) = 2 because 31 is prime (as 3 is in A023237), and 32 is composite
MAPLE
P := proc (n)
if isprime(10*ithprime(n)+1) then return 2 else 1;
end if:
end proc;
P(50);
seq(P(k), k = 1 .. 50);
MATHEMATICA
Table[k = 1; p = Prime[n]; While[PrimeQ[10^IntegerLength[k]*p + k], k++]; k, {n, 120}] (* Michael De Vlieger, Jun 30 2025 *)
PROG
(PARI) a(n) = my(k=1, p=Str(prime(n))); while (isprime(eval(concat(p, Str(k)))), k++); k; \\ Michel Marcus, Jun 07 2020
CROSSREFS
Sequence in context: A288739 A111621 A387535 * A078614 A140195 A196564
KEYWORD
nonn,base
AUTHOR
STATUS
approved