The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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). 1
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
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.
LINKS
EXAMPLE
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.
PROG
(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
(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
CROSSREFS
Sequence in context: A323296 A275782 A120005 * A105026 A350671 A077326
KEYWORD
nonn,base
AUTHOR
Eric Angelini and Hans Havermann, May 27 2023
EXTENSIONS
a(27) and beyond from Michael S. Branicky, May 27 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 17 09:51 EDT 2024. Contains 372581 sequences. (Running on oeis4.)