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

This page as a plain text file.
%I A362335 #44 May 28 2023 11:34:13
%S A362335 0,11,10,100,110,112,102,1002,1022,1102,1120,1124,1026,10028,10086,
%T A362335 10082,10866,10822,10886,10882,11086,11082,11208,11976,10928,100913,
%U A362335 10096,10093,10966,10933,10996,10993,11096,11093,22309,11309,23009,13009,23099,13099,23309
%N 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).
%C A362335 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.
%H A362335 Michael S. Branicky, <a href="/A362335/b362335.txt">Table of n, a(n) for n = 1..10000</a>
%e A362335 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.
%o A362335 (Python)
%o A362335 from itertools import count, islice
%o A362335 def c(k, d):
%o A362335     dk = list(map(int, str(k)))
%o A362335     return set(abs(dk[i+1]-dk[i]) for i in range(len(dk)-1)) >= d
%o A362335 def agen(): # generator of terms
%o A362335     an, aset = 0, {0}
%o A362335     while True:
%o A362335         yield an
%o A362335         d = set(map(int, set(str(an))))
%o A362335         an = next(k for k in count(10**len(d)) if k not in aset and c(k, d))
%o A362335         aset.add(an)
%o A362335 print(list(islice(agen(), 41))) # _Michael S. Branicky_, May 27 2023
%o A362335 def A362335(n, A=[0]):
%o A362335     while len(A) <= n:
%o A362335         z = lambda a: zip(d := tuple(int(d) for d in str(a)), d[1:])
%o A362335         D = set(str(A[-1])) ; a = 10**len(D)
%o A362335         while a in A or D - set(str(abs(x-y)) for x,y in z(a)): a += 1
%o A362335         A . append(a)
%o A362335     return A[n] # _M. F. Hasler_, May 27 2023
%o A362335 (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
%K A362335 nonn,base
%O A362335 1,2
%A A362335 _Eric Angelini_ and _Hans Havermann_, May 27 2023
%E A362335 a(27) and beyond from _Michael S. Branicky_, May 27 2023