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.

A362418 Beginning with 1, smallest positive integer not yet in the sequence such that two adjacent digits A and B of the sequence (also ignoring commas between terms) produce a prime = A + 3B. This is the earliest infinitely extensible such sequence.

Original entry on oeis.org

1, 2, 5, 4, 12, 7, 8, 14, 30, 120, 121, 20, 125, 21, 25, 27, 41, 45, 81, 201, 212, 50, 127, 85, 87, 214, 52, 54, 58, 70, 141, 230, 145, 250, 1201, 252, 72, 74, 301, 254, 501, 258, 78, 520, 1212, 521, 270, 1214, 525, 272, 527, 274, 541, 278, 545, 412, 581, 414
Offset: 1

Views

Author

Eric Angelini, Apr 19 2023

Keywords

Comments

The integer 10 is the first one that will never appear in the sequence (as the result of 1 + 3*0 is not a prime). The next absent will be 11.
From Michael S. Branicky, Apr 19 2023: (Start)
The only pairs AB allowed are 01, 12, 14, 16, 20, 21, 23, 25, 27, 29, 30, 41, 43, 45, 49, 50, 52, 54, 56, 58, 70, 72, 74, 78, 81, 83, 85, 87.
Further, any appearance of 6 or 9 as a digit would end the sequence, as would a term with last digit 3 (since next term cannot start with 0).
As long as no term ends in 3, 6, 9, the sequence is infinitely extensible since the cycle 01 -> 12 -> 20 -> 01 (at least) can be used to extend terms ending in 0, 1, or 2; the cycle 45 -> 54 -> 45 can be used to extend terms ending in 4 or 5; and 78 -> 87 -> 78 to extend terms ending in 7 or 8. (End)

Examples

			a(2) = 2 since the adjacent digits A=1 and B=2 are allowed (A+3B = 7 is prime).
a(3) is not 3 since a number ending 3 is never infinitely extensible, and not 4 since adjacent digits A=2 and B=4 are not allowed (A+3B = 14 not prime), but B=5 is allowed so a(3) = 5.
a(5) = 12 is the first 2-digit term and the digit pair 4,1 with the preceding a(4) is allowed, and also its own adjacent digits 1,2.
Digit A = 1 and B = 2 lead to 7 (prime) = A+3B;
Digit A = 2 and B = 5 lead to 17 (prime) = A+3B;
Digit A = 5 and B = 4 lead to 17 (prime) = A+3B;
Digit A = 4 and B = 1 lead to 7 (prime) = A+3B;
Digit A = 1 and B = 2 lead to 7 (prime) = A+3B;
Digit A = 2 and B = 1 lead to 5 (prime) = A+3B;
Digit A = 1 and B = 4 lead to 13 (prime) = A+3B; etc.
		

Crossrefs

Cf. A182178 (B is multiplied by 1), A362417 (B is multiplied by 2).

Programs

  • Python
    from sympy import isprime
    from itertools import islice
    def c(s):
        if s[-1] == "3" or "6" in s or "9" in s: return False
        return all(isprime(int(s[i])+3*int(s[i+1])) for i in range(len(s)-1))
    def agen(): # generator of terms
        last, aset = "1", {1}
        yield 1
        while True:
            k = 2
            while k in aset or not c(last+str(k)): k += 1
            an = k; yield an; last = str(an%10); aset.add(an)
    print(list(islice(agen(), 58))) # Michael S. Branicky, Apr 19 2023

Extensions

a(6)-a(7) inserted and a(21) and beyond from Michael S. Branicky, Apr 19 2023