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.

Previous Showing 11-13 of 13 results.

A341936 a(0) = 0; for n > 0, a(n) is the smallest positive integer not yet in the sequence that can be created by adding 1, 0, or -1, for digits > 0, to every digit in a(n-1).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 28, 27, 26, 25, 24, 23, 22, 21, 20, 30, 31, 32, 33, 34, 35, 36, 37, 38, 29, 39, 48, 47, 46, 45, 44, 43, 42, 41, 40, 50, 51, 52, 53, 54, 55, 56, 57, 58, 49, 59, 68, 67, 66, 65, 64, 63, 62, 61, 60, 70, 71, 72, 73
Offset: 0

Views

Author

Scott R. Shannon, Feb 23 2021

Keywords

Comments

Each individual digit in a(n-1) has either -1,0, or 1 added to it to find the next term. For example 23 can become 12,13,14,22,23,24,32,33,34. Of these options the lowest number not previously seen is then chosen for a(n). A 1 digit becomes 0,1 or 2, a zero digit becomes 0 or 1, while a 9 digit becomes 8,9 or 10 in the next term, e.g. 19 can become 8,9,10,18,19,110,28,29,210. Note that if a leading 1 becomes a 0 it is dropped, along with other leading 0's, for the next term.
The sequence is likely a permutation of the nonnegative integers. The lowest unused number after 1 million terms is 999897.

Examples

			a(1) = 1 as a(0) = 0 and the two numbers that can be created from 0 are 0 and 1, since 0 cannot have 1 subtracted. 0 has already occurred so 1 must be chosen.
a(20) = 28 as a(19) = 19 and the nine numbers that can be created from 19 are 8,9,10,18,19,110,28,29,210. The numbers 8,9,10,18,19 have already occurred and 28 is the smallest of the other four possibilities, so 28 is chosen.
a(29) = 30 as a(28) = 20 and the six numbers that can be created from 20 are 10,11,20,21,30,31. The numbers 10,11,20,21 have already occurred and 30 is the smallest of the other two possibilities, so 30 is chosen.
a(1870) = 995 as a(1869) = 1886 and of the 81 possible numbers that can be created from 1886, 995 is the smallest that has not previously occurred. This example shows that the terms can have a large drop in value if the leading digit can decrease by 1.
a(1875) = 8108 as a(1874) = 999 and of the 27 possible numbers that can be created from 999, 8108 is the smallest that has not previously occurred. This example shows that the terms can have a large increase in value if any of its 9 digits are forced to increase to 10.
		

Crossrefs

Cf. A341935 (add 1 or -1), A001477, A000027, A033075, A341002, A331163.

Programs

A341909 a(0) = 0; for n > 0, a(n) is the smallest positive integer not yet in the sequence such that the first digit of a(n) differs by 1 from the last digit of a(n-1).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 80, 10, 11, 20, 12, 13, 21, 22, 14, 30, 15, 40, 16, 50, 17, 60, 18, 70, 19, 81, 23, 24, 31, 25, 41, 26, 51, 27, 61, 28, 71, 29, 82, 32, 33, 42, 34, 35, 43, 44, 36, 52, 37, 62, 38, 72, 39, 83, 45, 46, 53, 47, 63, 48, 73, 49, 84, 54, 55, 64, 56, 57, 65, 66, 58, 74, 59
Offset: 0

Views

Author

Scott R. Shannon, Feb 23 2021

Keywords

Examples

			a(10) = 80 as the last digit of a(9) = 9 is 9, thus the first digit of a(10) must be 8. As 8 has already been used the next smallest number starting with 8 is 80.
a(16) = 21 as the last digit of a(15) = 13 is 3, thus the first digit of a(16) must be 2 or 4. As 2, 4 and 20 have already been used the next smallest number starting with 2 is 21.
		

Crossrefs

Programs

  • Mathematica
    Block[{a = {0}, k}, Do[k = 1; While[Nand[FreeQ[a, k], Abs[First@ IntegerDigits[k] - Mod[a[[-1]], 10]] == 1], k++]; AppendTo[a, k], {i, 76}]; a] (* Michael De Vlieger, Feb 23 2021 *)
  • Python
    def nextd(strn, d):
      n = int(strn) if strn != "" else 0
      return n+1 if str(n+1)[0] == str(d) else int(str(d)+'0'*len(strn))
    def aupton(term):
      alst, aset = [0], {0}
      lastdstr = ["" for d in range(10)]
      for n in range(1, term+1):
        lastdig = alst[-1]%10
        firstdigs = set([max(lastdig-1, 0), min(lastdig+1, 9)]) - {0}
        cands = [nextd(lastdstr[d], d) for d in firstdigs]
        m = min(cands)
        argmin = cands.index(m)
        alst.append(m)
        strm = str(m)
        lastdstr[int(strm[0])] = strm
      return alst
    print(aupton(76)) # Michael S. Branicky, Feb 23 2021

A341935 a(0) = 0; for n > 0, a(n) is the smallest positive integer not yet in the sequence that can be created by adding 1 or -1, for digits > 0, to every digit in a(n-1).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 21, 12, 23, 14, 25, 16, 27, 18, 29, 38, 47, 36, 45, 34, 43, 32, 41, 30
Offset: 0

Views

Author

Scott R. Shannon, Feb 23 2021

Keywords

Comments

The sequence is finite. After twenty-nine terms a(28) = 30 is reached after which no integer can be created that has not previously occurred. See the examples.

Examples

			a(1) = 1 as a(0) = 0 and the only number that can be created, since 0 can only be added to, is 0 + 1 = 1.
a(10) = 10 as a(9) = 9 and the two number that can be created from 9 are 8 and 10, but 8 has already occurred so 10 must be chosen.
a(11) = 21 as a(10) = 10 and the two numbers that can be created from 10 are '01' = 1 and 21, but 1 has already occurred so 21 must be chosen.
a(12) = 12 as (11) = 21 and the four numbers that can be created from 21 are 10, 12, 30, 32. The number 10 has already occurred and 12 is the smallest of the other three possibilities, so 12 is chosen.
a(28) = 30 as a(27) = 41 and the four numbers that can be created from 41 are 30, 32, 50, 52. The number 30 has not previously occurred and is the smallest of the possibilities, so 30 is chosen.
From 30 the two numbers that can be created are 21 and 41, both of which have already occurred, so the sequence terminates.
		

Crossrefs

Cf. A341936 (add -1 or 0 or 1), A001477, A000027, A033075, A341002, A331163.
Previous Showing 11-13 of 13 results.