OFFSET
1,1
COMMENTS
Conjecture: This is a permutation of the prime numbers.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..242
MAPLE
aList := proc(upto) local P, p, q, Y; Y := 2, 5;
P := select(isprime, [seq(2..upto)]):
for p in P do for q in P do
if isprime(q+(p+q)*10^(1+ilog10(q))) then break fi od:
if not member(q, [Y]) then Y := Y, q fi od;
Y end: aList(100000);
MATHEMATICA
spq[p_] := Module[{k = 2}, While[!PrimeQ[(p + k)*10^IntegerLength[k] + k], k = NextPrime[k]]; k];
Join[{2, 5}, DeleteDuplicates @ Table[spq[p], {p, Prime[Range[30000]]}]
PROG
(SageMath)
from more_itertools import unique_everseen
def f(p):
for q in Primes():
if is_prime(q + (p + q)*10^(1 + int(log(q, 10)))): return q
a = lambda n: unique_everseen((f(p) for p in prime_range(n)))
print([2, 5] + list(a(999)))
(PARI)
f(n) = my(k=2); while (!isprime(eval(concat(Str(prime(n)+k), Str(k)))), k = nextprime(k+1)); k; \\ A375553
lista(nn) = my(list=List()); listput(list, 2); listput(list, 5); for (n=1, nn, my(k=f(n)); if (#select(x->(x==k), Vec(list)) == 0, listput(list, k)); ); Vec(list); \\ Michel Marcus, Sep 17 2024
(Python)
from itertools import count, islice
from sympy import isprime, nextprime
def A375552_gen(): # generator of terms
p, a = 2, set()
yield from (2, 5)
while True:
q, m = 2, 10
for l in count(1):
while q<m:
if isprime(m*(p+q)+q):
if q not in a:
yield q
a.add(q)
break
q = nextprime(q)
else:
m *= 10
continue
break
p = nextprime(p)
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Sep 17 2024
STATUS
approved