OFFSET
1,1
COMMENTS
Is this sequence infinite?
Likely no, see A383780 and comment there. - Michael S. Branicky, May 11 2025
From Michael S. Branicky, May 16 2025: (Start)
Sequence is finite with 3356513448 terms (cf. A383780).
Last term: 70123916363515199416199518301698321195339012727994799190371992151279729974757397909992327936943877127375781091143 (End)
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..20000
Michael S. Branicky, Largest even-length (= 108 digits) then odd-length (= 113 digits) terms
EXAMPLE
211 is a term since 211 is a prime, 21 is a nonprime, and 2 is a prime;
23 is not a term since 23 and 2 are both prime.
MATHEMATICA
Unprotect[CompositeQ]; CompositeQ[1]:=True; Protect[CompositeQ]; Q[n_]:=And[AllTrue[FromDigits/@Table[Take[IntegerDigits[n], i], {i, IntegerLength[n], 1, -2}], PrimeQ], AllTrue[FromDigits/@Table[Take[IntegerDigits[n], i], {i, IntegerLength[n]-1, 1, -2}], CompositeQ]]; Select[Prime[Range[140]], Q]
PROG
(Python)
from gmpy2 import is_prime, mpz
from itertools import count, islice
def agen():
olst, elst = [2, 3, 5, 7], [11, 13, 17, 19, 41, 43, 47, 61, 67, 83, 89, 97]
yield from olst + elst
for n in count(1):
olst2, elst2 = [], []
for o in olst:
for i in range(1, 100, 2):
t = 100*o + i
if is_prime(t) and not is_prime(t//10):
olst2.append(t)
yield from olst2
for e in elst:
for i in range(100):
t = 100*e + i
if is_prime(t) and not is_prime(t//10):
elst2.append(t)
yield from elst2
olst, elst = olst2, elst2
print(list(islice(agen(), 70))) # Michael S. Branicky, May 11 2025
(Python) # predicate test useful for large n (cf. a-file of largest terms)
from gmpy2 import digits, is_prime, mpz
def ok(n):
s = digits(n)
return is_prime(n) and all(int(is_prime(mpz(s[:-i]))) == 1-i&1 for i in range(1, len(s)))
# Michael S. Branicky, May 16 2025
CROSSREFS
KEYWORD
nonn,base,fini
AUTHOR
Stefano Spezia, May 09 2025
STATUS
approved
