cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A383779 Primes where successively deleting the least significant digit yields a sequence that alternates between a prime and a nonprime at every step until a single-digit number remains.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 41, 43, 47, 61, 67, 83, 89, 97, 211, 223, 227, 229, 241, 251, 257, 263, 269, 271, 277, 281, 283, 307, 331, 337, 347, 349, 353, 359, 367, 383, 389, 397, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 701, 709, 727, 743, 751, 757, 761, 769, 773, 787
Offset: 1

Views

Author

Stefano Spezia, May 09 2025

Keywords

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)

Examples

			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.
		

Crossrefs

Programs

  • 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]
  • 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