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-7 of 7 results.

A182178 Beginning with 1, 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

1, 2, 3, 4, 7, 6, 5, 8, 9, 20, 21, 11, 12, 14, 16, 50, 23, 25, 29, 41, 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
Offset: 1

Views

Author

Jim Nastos and Eric Angelini, Apr 16 2012

Keywords

Comments

See A219110 for the numbers which do not occur in this sequence. See A219250 for the analog when "sum" is replaced with "absolute difference", and A219248-A219251 for related sequences. - M. F. Hasler, Apr 11 2013

Examples

			20 follows 9 since 9+2 and 2+0 is prime, and no number less than 20 (not already in the sequence) satisfies the stated property.
		

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = For[id = IntegerDigits[a[n-1]]; k = 1, True, k++, If[FreeQ[Array[a, n-1], k], dd = Join[id, IntegerDigits[k]]; If[And @@ PrimeQ /@ Plus @@@ Transpose[{Most[dd], Rest[dd]}], Return[k]]]]; Array[a, 62] (* Jean-François Alcover, Apr 17 2013 *)
  • PARI
    A182178_vec={(n, a=[1], u=0)->while(#aM. F. Hasler, Apr 11 2013

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

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))}

A365375 Numbers being the smallest positive integer having its digits (Cf. A179239) from which two digits can be chosen, the difference being any value from 0 to 9.

Original entry on oeis.org

100269, 100479, 101269, 101479, 102269, 102669, 102699, 104479, 104779, 104799, 200589, 202589, 205589, 205889, 205899, 300789, 303789, 307789, 307889, 307899, 1000269, 1000479, 1001269, 1001479, 1002269, 1002349, 1002359, 1002369, 1002379, 1002469, 1002479, 1002489, 1002569, 1002579
Offset: 1

Views

Author

Keywords

Comments

Anagrams of the terms are not included in the sequence.
There are 320 such numbers up to 10^7, the largest being 5067899.

Examples

			a(1) = 100269 and we have:
  0 = 0 - 0
  1 = 1 - 0
  2 = 2 - 0
  3 = 9 - 6
  4 = 6 - 2
  5 = 6 - 1
  6 = 6 - 0
  7 = 9 - 2
  8 = 9 - 1
  9 = 9 - 0
The integer 102069 being an anagram of 100269 is not in the sequence (though 102069 also produces the 10 digits).
		

Crossrefs

Programs

  • Mathematica
    lst={};Do[If[Union@Flatten[Abs@*Differences/@Subsets[IntegerDigits@k,{2}]]==Range[0,9],If[FreeQ[lst,s=Sort@IntegerDigits@k],AppendTo[lst,s];Print@k]],{k,10^6}]
  • Python
    from itertools import count, islice, combinations, combinations_with_replacement as mc
    def c(t):
        d = list(map(int, t))
        return len(set(abs(d[i]-d[j]) for i, j in combinations(range(len(d)), 2))) == 10
    def bgen():
        D = "123456789"
        return ((D[i],)+r for d in count(1) for i in range(9) for r in mc("0"+D[i:], d-1))
    def agen():
        yield from (int("".join(t)) for t in filter(c, bgen()))
    print(list(islice(agen(), 34))) # Michael S. Branicky, Sep 11 2024

Extensions

Name specified by David A. Corneth, Sep 11 2024

A376128 The absolute difference of two successive terms is prime and the absolute difference of two successive digits is also prime.

Original entry on oeis.org

0, 2, 4, 1, 3, 5, 7, 9, 6, 8, 13, 16, 14, 25, 20, 27, 24, 29, 42, 47, 49, 46, 35, 30, 53, 50, 31, 36, 38, 57, 52, 41, 64, 61, 63, 58, 69, 72, 70, 75, 86, 81, 68, 135, 74, 79, 242, 469, 246, 83, 85, 252, 425, 202, 413, 130, 203, 136, 131, 358, 147, 94, 92, 97, 270, 241, 302, 429, 250, 207, 205, 258, 149
Offset: 1

Views

Author

Eric Angelini and Jean-Marc Falcoz, Sep 11 2024

Keywords

Examples

			Terms a(1) to a(15) are 0,2,4,1,3,5,7,9,6,8,13,16,14,25,20.
The successive absolute differences between two terms are the primes 2,2,3,2,2,2,2,3,2,5,3,2,11,5.
The successive absolute differences between two digits are the primes 2,2,3,2,2,2,2,3,2,7,2,2,5,5,3,2,3,3,2.
		

Crossrefs

Programs

  • Python
    # uses A219248gen in A219248
    from sympy import isprime
    from itertools import count, islice
    def c(an, k):
        return isprime(abs(an-k)) and isprime(abs(an%10-int(str(k)[0])))
    def agen(): # generator of terms
        an, aset = 0, {0}
        while True:
            yield an
            an = next(k for k in A219248gen(seed=str(an%10)) if k not in aset and c(an, k))
            aset.add(an)
    print(list(islice(agen(), 73))) # Michael S. Branicky, Sep 11 2024
Showing 1-7 of 7 results.