OFFSET
1,2
COMMENTS
The term a(n) must always be exactly one digit longer or shorter than the term a(n+1).
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
Eric Angelini, Combs and Pharaohs, personal blog of the author.
EXAMPLE
Interpenetrate a(1) = 0 and a(2) = 11 to form 101 (a prime number);
interpenetrate a(2) = 11 and a(3) = 3 to form 131 (a prime number);
interpenetrate a(3) = 3 and a(4) = 17 to form 137 (a prime number);
interpenetrate a(4) = 17 and a(5) = 2 to form 127 (a prime number);
interpenetrate a(5) = 2 and a(6) = 23 to form 223 (a prime number);
interpenetrate a(6) = 23 and a(7) = 6 to form 263 (a prime number);
interpenetrate a(7) = 6 and a(8) = 13 to form 163 (a prime number);
interpenetrate a(8) = 13 and a(9) = 1 to form 113 (a prime number);
(...)
interpenetrate a(18) = 39 and a(19) = 103 to form 13093 (a prime number);
(...)
interpenetrate a(167) = 277 and a(168) = 1009 to form 1207079 (a prime number); etc.
MAPLE
Q:= proc(a, b) local La, Lb, i;
La:= convert(a, base, 10);
Lb:= convert(b, base, 10);
add(La[i]*10^(2*i-2), i=1..nops(La)) + add(Lb[i]*10^(2*i-1), i=1..nops(Lb))
end proc:
f:= proc(n) local d, x;
d:= 1+ilog10(n);
if n::odd then
for x from 10^(d-2) to 10^(d-1) - 1 do
if not(member(x, S)) and isprime(Q(n, x)) then return x fi
od
fi;
for x from 10^d+1 to 10^(d+1) - 1 by 2 do
if not(member(x, S)) and isprime(Q(x, n)) then return x fi
od;
FAIL
end proc:
R:= 0, 11: S:= {0, 11}: v:= 11:
for i from 2 to 100 do
v:= f(v);
R:= R, v;
S:= S union {v};
od:
R; # Robert Israel, Aug 22 2024
PROG
(Python)
from sympy import isprime
from itertools import islice
def ip(s, t): return int("".join(x+v for x, v in zip(s, t))+s[-1])
def agen(): # generator of terms
seen, an, found = set(), 0, True
while found:
yield an
seen.add(an)
s = str(an)
d, found = len(s), False
if s[-1] in "1379" and d > 1:
for k in range(10**(d-2), 10**(d-1)):
if k not in seen and isprime(ip(s, str(k))):
an, found = k, True
break
if not found:
for k in range(10**d, 10**(d+1)):
if k not in seen and isprime(ip(str(k), s)):
an, found = k, True
break
print(list(islice(agen(), 90))) # Michael S. Branicky, Aug 22 2024
CROSSREFS
KEYWORD
AUTHOR
Eric Angelini and Jean-Marc Falcoz, Aug 22 2024
STATUS
approved