

A341011


a(n) is the smallest positive number m not yet in the sequence with the property that the sum of the even digits of m and the sum of the odd digits of m differ by n.


2



112, 1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 119, 39, 139, 59, 159, 79, 179, 99, 199, 488, 399, 688, 599, 888, 799, 1799, 999, 1999, 11999, 3999, 13999, 5999, 15999, 7999, 17999, 9999, 19999, 68888, 39999, 88888, 59999, 159999, 79999, 179999, 99999, 199999, 1199999, 399999, 1399999, 599999, 1599999, 799999, 1799999, 999999
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,1


COMMENTS

This is the lexicographically earliest sequence of distinct integers > 0 having this property.
Indices of terms not congruent to 9 (mod 10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 20, 22, 24, 38, 40, 56, ....  Robert G. Wilson v, Feb 21 2021


LINKS

Robert G. Wilson v, Table of n, a(n) for n = 0..8983 (terms 1 to 100 from Carole Dubois)


EXAMPLE

a(19) = 199 since 199 is the smallest number such that the sum of even digits (0) and the sum of odd digits (19) differ by n = 19;
a(20) = 488 since 488 is the smallest number such that the sum of even digits (20) and the sum of odd digits (0) differ by n = 20; etc.


MATHEMATICA

del[n_] := Abs[Plus @@ Select[(d = IntegerDigits[n]), OddQ]  Plus @@ Select[d, EvenQ]]; m = 54; s = Table[0, {m}]; c = n = 0; While[c < m, n++; i = del[n]; If[i > 0 && i <= m && s[[i]] == 0, c++; s[[i]] = n]]; s (* Amiram Eldar, Feb 02 2021 *)
f[n_] := Block[{b, c, d, e, o}, d = 0; c = Floor[n/9]; b = 10^c 1; While[n != (Plus @@ IntegerDigits[d*10^c + b]), If[ OddQ@ d, d += 2, d++]]; o = d*10^c + b;
d = 0; c = Floor[n/8]; b = 8(10^c 1)/9; While[n != (Plus @@ IntegerDigits[d*10^c + b]), If[ OddQ@ d, d++, d += 2]]; e = d*10^c + b; Min[o, e]]; f[0] = 112; (* Robert G. Wilson v, Feb 21 2021 *)


CROSSREFS

Cf. A009994, A036301, A341002, A341003, A341004, A341005, A341006, A341007, A341008, A341009, A341010.
Sequence in context: A262661 A156407 A292155 * A103849 A340470 A010032
Adjacent sequences: A341008 A341009 A341010 * A341012 A341013 A341014


KEYWORD

base,nonn


AUTHOR

Carole Dubois and Eric Angelini, Feb 02 2021


EXTENSIONS

a(0) added by Robert G. Wilson v, Feb 21 2021


STATUS

approved



