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

A352927 Numbers whose digits are nonzero, consecutive, and all increasing or all decreasing.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 21, 23, 32, 34, 43, 45, 54, 56, 65, 67, 76, 78, 87, 89, 98, 123, 234, 321, 345, 432, 456, 543, 567, 654, 678, 765, 789, 876, 987, 1234, 2345, 3456, 4321, 4567, 5432, 5678, 6543, 6789, 7654, 8765, 9876, 12345, 23456, 34567, 45678, 54321, 56789, 65432, 76543, 87654, 98765, 123456, 234567, 345678
Offset: 1

Views

Author

N. J. A. Sloane, May 01 2022, following a suggestion from Ralph Sieber

Keywords

Comments

There are 81 terms, corresponding to numbers that start with i and end with j, for 1 <= i <= 9, 1 <= j <= 9. - Michael S. Branicky, May 01 2022

Crossrefs

Programs

  • Mathematica
    Join[Range[9],Select[Range[350000],DigitCount[#,10,0]==0&&(Union[Differences[IntegerDigits[ #]]]=={1}||Union[Differences[IntegerDigits[#]]]=={-1})&]] (* Harvey P. Dale, Aug 13 2023 *)
  • Python
    def sgn(n): return 1 if n >= 0 else -1
    def afull(): return sorted(int("".join(map(str, range(i, j+sgn(j-i), sgn(j-i))))) for i in range(1, 10) for j in range(1, 10))
    print(afull()) # Michael S. Branicky, May 01 2022

A252481 Numbers whose set of digits is simply connected to 1.

Original entry on oeis.org

1, 10, 11, 12, 21, 100, 101, 102, 110, 111, 112, 120, 121, 122, 123, 132, 201, 210, 211, 212, 213, 221, 231, 312, 321, 1000, 1001, 1002, 1010, 1011, 1012, 1020, 1021, 1022, 1023, 1032, 1100, 1101, 1102, 1110, 1111, 1112, 1120, 1121, 1122, 1123, 1132, 1200, 1201, 1202, 1203, 1210, 1211, 1212, 1213, 1220, 1221, 1222, 1223
Offset: 1

Views

Author

M. F. Hasler, Dec 24 2014

Keywords

Comments

"Simply connected" means that there must not be a "hole" in the set of digits. E.g., {1,2,4} would not be allowed since '3' is missing.

Crossrefs

Programs

  • PARI
    is(n)={d=Set(digits(n));d[1]==1 || (#d>1&&d[2]==1) || return; d[#d]==#d-!d[1]}
    
  • Python
    def ok(n):
      s = set(str(n)); return '1' in s and len(s) == ord(max(s))-ord(min(s))+1
    def aupto(nn): return [m for m in range(1, nn+1) if ok(m)]
    print(aupto(1223)) # Michael S. Branicky, Jan 10 2021

A357142 Nonnegative numbers all of whose pairs of consecutive decimal digits are adjacent digits, where 9 and 0 are considered adjacent.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 21, 23, 32, 34, 43, 45, 54, 56, 65, 67, 76, 78, 87, 89, 90, 98, 101, 109, 121, 123, 210, 212, 232, 234, 321, 323, 343, 345, 432, 434, 454, 456, 543, 545, 565, 567, 654, 656, 676, 678, 765, 767, 787, 789, 876, 878, 890, 898, 901, 909
Offset: 1

Views

Author

Ofer Zivony, Sep 14 2022

Keywords

Comments

This is very similar to A033075, with the exception of considering 0 and 9 as adjacent digits. This allows these digits to be equal to the other digits, making it a more balanced list.

Crossrefs

Cf. A032981, A033075, A043089 (ternary analog), A048491.

Programs

  • Maple
    q:= n-> (l-> andmap(x-> x in {1, 9}, {seq(abs(l[i]-l[i-1]),
                 i=2..nops(l))}))(convert(n, base, 10)):
    select(q, [$0..1000])[];  # Alois P. Heinz, Sep 14 2022
  • Mathematica
    q[n_] := AllTrue[Abs @ Differences @ IntegerDigits[n], MemberQ[{1, 9}, #] &]; Select[Range[0, 1000], q] (* Amiram Eldar, Sep 15 2022 *)
  • PARI
    a(n) = { n--; for (b=0, oo, if (n <= 9*2^b, my (v=ceil(n/2^b), p=(n-1)%(2^b)); while (b>0, v=10*v+vecsort([(v-1)%10, (v+1)%10])[1+bittest(p,b--)];); return (v), n -= 9*2^b)) } \\ Rémy Sigrist, Sep 15 2022
  • Python
    def add_dig(x):
      d = (x%10-1)%8 if x%10 != 0 else 1
      return 10*x+d
    def try_incr(x):
      if x < 10: return x+1
      r = x//10
      d2 = r%10
      d = max((d2+1)%10,(d2-1)%10)
      return 10*r+d
    def incr(x):
      new_x=try_incr(x)
      return new_x if new_x>x else add_dig(incr(x//10))
    x = 0
    for n in range(1,1000):
      print(f"{n} {x}")
      x = incr(x)
    
Previous Showing 21-23 of 23 results.