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.

A362335 Lexicographically earliest sequence of distinct nonnegative terms wherein every digit of a(n) is the absolute difference of two adjacent digits in a(n+1).

Original entry on oeis.org

0, 11, 10, 100, 110, 112, 102, 1002, 1022, 1102, 1120, 1124, 1026, 10028, 10086, 10082, 10866, 10822, 10886, 10882, 11086, 11082, 11208, 11976, 10928, 100913, 10096, 10093, 10966, 10933, 10996, 10993, 11096, 11093, 22309, 11309, 23009, 13009, 23099, 13099, 23309
Offset: 1

Views

Author

Eric Angelini and Hans Havermann, May 27 2023

Keywords

Comments

All terms > a(24) contain at least one 9 with an adjacent 0. All terms > a(25) contain at least one instance of identical adjacent digits.

Examples

			a(125) = 9902. The next term is 10097, not 20009, because, in spite of its providing more digit differences than are needed, it is lexicographically earlier.
		

Programs

  • PARI
    {upto(N) = my(U=[], a=0); vector(N,n, if(n>1, my(da=Set(if(a,digits(a)))); a=10^#da; while( setsearch(U,a) || #setminus(da, Set(abs((n=digits(a))[^1]-n[^-1]))), a++)); U=setunion(U,[a]); a)} \\ M. F. Hasler, May 27 2023
  • Python
    from itertools import count, islice
    def c(k, d):
        dk = list(map(int, str(k)))
        return set(abs(dk[i+1]-dk[i]) for i in range(len(dk)-1)) >= d
    def agen(): # generator of terms
        an, aset = 0, {0}
        while True:
            yield an
            d = set(map(int, set(str(an))))
            an = next(k for k in count(10**len(d)) if k not in aset and c(k, d))
            aset.add(an)
    print(list(islice(agen(), 41))) # Michael S. Branicky, May 27 2023
    def A362335(n, A=[0]):
        while len(A) <= n:
            z = lambda a: zip(d := tuple(int(d) for d in str(a)), d[1:])
            D = set(str(A[-1])) ; a = 10**len(D)
            while a in A or D - set(str(abs(x-y)) for x,y in z(a)): a += 1
            A . append(a)
        return A[n] # M. F. Hasler, May 27 2023
    

Extensions

a(27) and beyond from Michael S. Branicky, May 27 2023