login
A375553
a(n) is the smallest prime q such that the concatenation (p + q)"q is a prime number, where p = prime(n).
2
3, 7, 3, 3, 19, 3, 31, 3, 3, 7, 11, 17, 3, 3, 3, 3, 13, 3, 29, 3, 23, 3, 3, 7, 41, 7, 3, 3, 3, 3, 3, 31, 7, 3, 3, 3, 11, 3, 7, 19, 3, 11, 7, 11, 3, 11, 3, 23, 7, 47, 19, 3, 23, 3, 7, 3, 7, 11, 3, 3, 11, 3, 23, 7, 3, 3, 3, 29, 7, 11, 7, 3, 11, 23, 3, 3, 3, 3, 13
OFFSET
1,1
COMMENTS
Conjecture: The image of this sequence joined with {2, 5} are the prime numbers, {2, 5} union imag(a) = P.
MAPLE
P := select(isprime, [seq(2..405)]):
g := p -> local q;
for q in P do
if isprime(q + (p + q)*10^(1 + ilog10(q))) then return q fi
od:
map(g, P);
MATHEMATICA
spq[p_]:=Module[{k=2}, While[!PrimeQ[(p+k)*10^IntegerLength[k]+k], k=NextPrime[k]]; k]; Table[spq[p], {p, Prime[Range[80]]}] (* Harvey P. Dale, Sep 24 2024 *)
PROG
(SageMath)
def f(p):
for q in Primes():
if is_prime(q + (p + q)*10^(1 + int(log(q, 10)))): return q
print([f(p) for p in prime_range(405)])
(PARI)
a(n) = my(k=2); while (!isprime(eval(concat(Str(prime(n)+k), Str(k)))), k = nextprime(k+1)); k; \\ Michel Marcus, Sep 17 2024
(Python)
from itertools import count
from sympy import prime, isprime, nextprime
def A375553(n):
p, q, m = prime(n), 2, 10
for l in count(1):
while q<m:
if isprime(m*(p+q)+q):
return q
q = nextprime(q)
m *= 10 # Chai Wah Wu, Sep 18 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Peter Luschny, Sep 17 2024
STATUS
approved