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!)
A366197 Lexicographically earliest permutation of the nonnegative integers such that the absolute difference between the digitsum of a(n) and the digitsum of a(n+2) = 1. 1
0, 1, 10, 2, 11, 3, 12, 4, 13, 5, 14, 6, 15, 7, 16, 8, 17, 9, 18, 19, 26, 27, 25, 28, 24, 29, 23, 37, 22, 36, 21, 35, 20, 34, 30, 33, 31, 32, 41, 40, 42, 50, 43, 51, 44, 52, 45, 53, 46, 54, 38, 55, 39, 47, 49, 48, 57, 56, 58, 64, 59, 63, 67, 62, 66, 61, 65, 60 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
EXAMPLE
DS stands hereunder for DigitSum:
a(0) = 0 (DS 0) and a(2) = 10 (DS 1) and the absolute difference 0 - 1 = 1;
a(1) = 1 (DS 1) and a(3) = 2 (DS 2) and the absolute difference 1 - 2 = 1;
a(2) = 10 (DS 1) and a(4) = 11 (DS 2) and the absolute difference 1 - 2 = 1;
a(3) = 2 (DS 2) and a(5) = 3 (DS 3) and the absolute difference 2 - 3 = 1;
a(4) = 11 (DS 2) and a(6) = 12 (DS 3) and the absolute difference 2 - 3 = 1; etc.
PROG
(Python)
from itertools import count, filterfalse
def DS(y):
z = str(y)
return sum(int(z[i]) for i in range (0, len(z)))
def A366197_list(n_max):
A = [0, 1]
S = set(A)
for n in range(2, n_max+1):
for i in filterfalse(S.__contains__, count(1)):
if abs(DS(A[n-2])-DS(i)) == 1:
A.append(i)
S.add(i)
break
return(A) # John Tyler Rascoe, Oct 22 2023
CROSSREFS
Sequence in context: A111287 A255668 A187815 * A318486 A303850 A303848
KEYWORD
base,nonn
AUTHOR
Eric Angelini, Oct 03 2023
EXTENSIONS
More terms from Alois P. Heinz, Oct 03 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 19 19:45 EDT 2024. Contains 372703 sequences. (Running on oeis4.)