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.

Showing 1-9 of 9 results.

A182175 Numbers with the property that every pair of adjacent digits sum to a prime number.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 16, 20, 21, 23, 25, 29, 30, 32, 34, 38, 41, 43, 47, 49, 50, 52, 56, 58, 61, 65, 67, 70, 74, 76, 83, 85, 89, 92, 94, 98, 111, 112, 114, 116, 120, 121, 123, 125, 129, 141, 143, 147, 149, 161, 165, 167, 202, 203, 205, 207, 211, 212, 214, 216, 230, 232, 234
Offset: 1

Views

Author

Jim Nastos, Apr 16 2012

Keywords

Comments

Complement of A219110. - M. F. Hasler, Apr 11 2013

Examples

			983 is in the sequence since 9+8 is prime and 8+3 is prime.
		

Crossrefs

These are the candidate numbers for extending A182178.
Cf. A219110.

Programs

  • Maple
    N:= 4: # to get all terms with up to N digits.
    for p from 0 to 9 do P[p]:= select(t -> isprime(t+p),[$0..9]) od:
    F:= proc(t) local r,p; r:= t mod 10; op(map(`+`,P[r],10*t)) end proc:
    S[1]:= {$1..9}:
    for j from 2 to N do S[j]:= map(F,S[j-1]) od:
    `union`({0},seq(S[j],j=1..N));
    # if using Maple 11 or lower, uncomment the next line:
    # sort(convert(%,list));
    # Robert Israel, Oct 27 2014
  • Mathematica
    fQ[n_] := Module[{d = IntegerDigits[n], s}, s = Most[d] + Rest[d]; And @@ PrimeQ[s]]; Flatten[Join[{Range[0,9],Select[Range[11, 300], fQ]}]] (* T. D. Noe, Aug 21 2012 and Apr 17 2013; modified by Zak Seidov, Oct 28 2014 *)
  • PARI
    is_A182175(n)=!for(i=2, #n=digits(n), isprime(n[i-1]+n[i])||return) \\ M. F. Hasler, Oct 27 2014

A219248 Numbers such that the absolute difference of any two adjacent (decimal) digits is prime.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 14, 16, 18, 20, 24, 25, 27, 29, 30, 31, 35, 36, 38, 41, 42, 46, 47, 49, 50, 52, 53, 57, 58, 61, 63, 64, 68, 69, 70, 72, 74, 75, 79, 81, 83, 85, 86, 92, 94, 96, 97, 130, 131, 135, 136, 138, 141, 142, 146, 147, 149, 161, 163, 164
Offset: 1

Views

Author

M. F. Hasler, Apr 12 2013

Keywords

Comments

Numbers which may (and do) occur in A219250 and A219249 (union {0}).
This is to A219250 and A219249 what A182175 is to A182177 and A182178.

Programs

  • Mathematica
    Select[Range[0,200],And@@PrimeQ[Abs[Differences[IntegerDigits[#]]]]&] (* Harvey P. Dale, Jun 06 2014 *)
  • PARI
    is_A219248(n)={!for(i=2,#n=digits(n),isprime(abs(n[i-1]-n[i]))||return)}
    
  • Python
    def ok(n):
        d = list(map(int, str(n)))
        return all(abs(d[i]-d[i-1]) in {2,3,5,7} for i in range(1, len(d)))
    print([k for k in range(164) if ok(k)]) # Michael S. Branicky, Sep 11 2024
    
  • Python
    from itertools import count, islice
    def A219248gen(seed=None): # generator of terms
        nxt = {None:"123456789", "0":"2357", "1":"3468", "2":"04579",
            "3":"01568", "4":"12679", "5":"02378", "6":"13489",
            "7":"02459", "8":"1356", "9":"2467"}
        def bgen(d, seed=None):
            if d == 0: yield tuple(); return
            yield from ((i,)+t for i in nxt[seed] for t in bgen(d-1, seed=i))
        yield 0
        for d in count(1):
            yield from (int("".join(t)) for t in bgen(d, seed=seed))
    print(list(islice(A219248gen(), 65))) # Michael S. Branicky, Sep 11 2024

A219250 Lexicographically earliest sequence of nonnegative integers such that the absolute difference of any two adjacent digits is prime.

Original entry on oeis.org

0, 2, 4, 1, 3, 5, 7, 9, 6, 8, 13, 14, 16, 18, 30, 20, 24, 25, 27, 29, 41, 31, 35, 36, 38, 50, 52, 42, 46, 47, 49, 61, 63, 53, 57, 58, 64, 68, 69, 70, 72, 74, 75, 79, 202, 92, 94, 96, 81, 83, 85, 86, 97, 203, 130, 205, 207, 241, 302, 413, 131, 303, 135, 242, 414, 136, 138, 141, 305, 246, 142, 416, 146, 147, 247, 249
Offset: 1

Views

Author

M. F. Hasler, Apr 11 2013

Keywords

Comments

See A219249 for the version allowing only positive integers, i.e., starting with a(1)=1.
See A219248 (= range of A219250) for the numbers which occur in this sequence, and A219251 for the complement.
A182177 is the analog of this sequence for replacing "absolute difference" by "sum", A182178 is the same analog for A219249; A182175 is the analog of A219248 and A219110 corresponds to A219251.

Programs

  • PARI
    {(n,a=[0],u=0)->while(#a
    				

A182177 Beginning with 0, smallest positive integer not yet in the sequence such that two adjacent digits of the sequence (also ignoring commas between terms) sum to a prime.

Original entry on oeis.org

0, 2, 1, 4, 3, 8, 5, 6, 7, 41, 11, 12, 9, 20, 21, 14, 16, 50, 23, 25, 29, 43, 47, 49, 83, 85, 61, 65, 67, 411, 111, 112, 30, 32, 34, 38, 52, 56, 58, 92, 94, 70, 74, 76, 114, 98, 302, 116, 120, 202, 121, 123, 89, 203, 205, 207, 412, 125, 211, 129, 212, 141, 143, 214, 147, 414, 149, 216, 161, 165, 230, 232, 167, 416, 502, 303, 234, 305, 238, 307, 430, 250, 252, 320, 256, 503, 258, 321, 292, 323, 294, 325, 298, 329, 432, 341, 434, 343, 438, 347, 470, 349
Offset: 1

Views

Author

Jim Nastos and Eric Angelini, Apr 16 2012

Keywords

Comments

A219250 is the analog of this sequence, replacing "sum" by "absolute difference". A219249 is the same analog for A182178. A219248 is the analog of A182175 and A219251 corresponds to A219110 = terms which do not occur in this sequence, i.e., the complement of its range. - M. F. Hasler, Apr 12 2013

Examples

			41 appears after 7 because 7+4 is prime and 4+1 is prime, and no other number less than 41 (not already in the sequence) satisfies this property. Example: 11 does not directly follow 7 since 7+1 is not prime.
		

Crossrefs

Cf. A182175.

Programs

  • PARI
    A182177_vec={(n, a=[0], u=0)->while(#aM. F. Hasler, Apr 11 2013

A219110 Numbers for which at least one sum of two adjacent digits is not prime.

Original entry on oeis.org

10, 13, 15, 17, 18, 19, 22, 24, 26, 27, 28, 31, 33, 35, 36, 37, 39, 40, 42, 44, 45, 46, 48, 51, 53, 54, 55, 57, 59, 60, 62, 63, 64, 66, 68, 69, 71, 72, 73, 75, 77, 78, 79, 80, 81, 82, 84, 86, 87, 88, 90, 91, 93, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105
Offset: 1

Views

Author

M. F. Hasler, Apr 11 2013

Keywords

Comments

Different from A104211 where ("only") the sum of all digits is considered; of course exactly the two-digit terms coincide.
Numbers missing in A182177 and A182178. Otherwise said, complement of the range of A182177 (in the set of nonnegative integers) and of the range of A182178 (in the set of positive integers) and of A182175 in the set of integers > 9.

Examples

			102 is here because 1+0 is not prime (even though 0+2 is).
		

Programs

  • Mathematica
    Select[Range[10, 105], MemberQ[PrimeQ[Total /@ Partition[IntegerDigits[#], 2, 1]], False] &] (* T. D. Noe, Apr 16 2013 *)
  • PARI
    is(n)=for(i=2,#n=digits(n),isprime(n[i-1]+n[i])||return(1))

A219249 Lexicographically earliest sequence of positive integers such that the absolute difference of any two adjacent digits is prime.

Original entry on oeis.org

1, 3, 5, 2, 4, 6, 8, 13, 14, 7, 9, 20, 24, 16, 18, 30, 25, 27, 29, 41, 31, 35, 36, 38, 50, 52, 42, 46, 47, 49, 61, 63, 53, 57, 58, 64, 68, 69, 70, 72, 74, 75, 79, 202, 92, 94, 96, 81, 83, 85, 86, 97, 203, 130, 205, 207, 241, 302, 413, 131, 303, 135, 242, 414, 136, 138, 141, 305, 246, 142, 416, 146, 147, 247, 249, 250
Offset: 1

Views

Author

Eric Angelini and M. F. Hasler, Apr 11 2013

Keywords

Comments

See A219250 for the version allowing nonnegative integers, i.e., starting with a(1)=0.
See A219248 for the numbers which occur in this sequence, and A219251 for the complement.

Crossrefs

Programs

  • PARI
    {A219249(n,a=[1],u=0)=while(#a
    				

A219251 Numbers such that the absolute difference of a pair of adjacent decimal digits is not prime.

Original entry on oeis.org

10, 11, 12, 15, 17, 19, 21, 22, 23, 26, 28, 32, 33, 34, 37, 39, 40, 43, 44, 45, 48, 51, 54, 55, 56, 59, 60, 62, 65, 66, 67, 71, 73, 76, 77, 78, 80, 82, 84, 87, 88, 89, 90, 91, 93, 95, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129
Offset: 1

Views

Author

M. F. Hasler, Apr 11 2013

Keywords

Comments

Complement of A219248; numbers which do not occur in A219249 and A219250; analog of what is A219110 to A182177, A182178.

Programs

  • PARI
    is_A219251(n)={for(i=2, #n=digits(n), isprime(abs(n[i-1]-n[i]))||return(1))}

A362417 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 + 2B. This is the earliest infinitely extensible such sequence.

Original entry on oeis.org

1, 3, 5, 7, 20, 11, 9, 13, 15, 19, 50, 111, 30, 113, 51, 31, 35, 37, 53, 57, 59, 70, 115, 73, 75, 91, 95, 97, 201, 119, 120, 130, 131, 135, 137, 301, 150, 151, 153, 157, 311, 159, 191, 195, 197, 313, 501, 315, 319, 511, 320, 1111, 350, 1113, 513, 515, 351, 353
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 + 2*0 is not a prime). The next absent will be 14.
From Michael S. Branicky, Apr 19 2023: (Start)
The only allowed pairs of digits AB are 01, 11, 12, 13, 15, 16, 18, 19, 20, 30, 31, 32, 34, 35, 37, 38, 50, 51, 53, 54, 56, 57, 59, 70, 72, 73, 75, 76, 78, 91, 92, 94, 95, 97.
Further, any appearance of 4, 6, or 8 as a digit would end the sequence, as would a term with last digit 2 (since the next term cannot start with 0).
As long as no term ends in 2, 4, 6, or 8, the sequence is infinitely extensible since the edge and cycle 01 -> 13 -> 31 -> 13 (at least) can be used to extend terms ending in 0, 1, or 3; and 75 -> 59 -> 97 to extend terms ending in 5, 7, or 9. (End)

Examples

			Digit A = 1 and B = 3 lead to 7 (prime) = A+2B;
Digit A = 3 and B = 5 lead to 13 (prime) = A+2B;
Digit A = 5 and B = 7 lead to 19 (prime) = A+2B;
Digit A = 7 and B = 2 lead to 11 (prime) = A+2B;
Digit A = 2 and B = 0 lead to 2 (prime) = A+2B;
Digit A = 0 and B = 1 lead to 2 (prime) = A+2B;
Digit A = 1 and B = 1 lead to 3 (prime) = A+2B; etc.
		

Crossrefs

Cf. A182178 (B is multiplied by 1), A362418 (B is multiplied by 3).

Programs

  • Python
    from sympy import isprime
    from itertools import islice
    def c(s):
        if s[-1] == "2" or "4" in s or "6" in s or "8" in s: return False
        return all(isprime(int(s[i])+2*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); aset.add(an)
    print(list(islice(agen(), 58))) # Michael S. Branicky, Apr 19 2023

Extensions

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

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
Showing 1-9 of 9 results.