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

%I #32 Mar 24 2021 02:58:36

%S 112,1,2,3,4,5,6,7,8,9,19,119,39,139,59,159,79,179,99,199,488,399,688,

%T 599,888,799,1799,999,1999,11999,3999,13999,5999,15999,7999,17999,

%U 9999,19999,68888,39999,88888,59999,159999,79999,179999,99999,199999,1199999,399999,1399999,599999,1599999,799999,1799999,999999

%N 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.

%C This is the lexicographically earliest sequence of distinct integers > 0 having this property.

%C 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

%H Robert G. Wilson v, <a href="/A341011/b341011.txt">Table of n, a(n) for n = 0..8983</a> (terms 1 to 100 from Carole Dubois)

%e 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;

%e 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.

%t 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 *)

%t 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;

%t 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 *)

%Y Cf. A009994, A036301, A341002, A341003, A341004, A341005, A341006, A341007, A341008, A341009, A341010.

%K base,nonn

%O 0,1

%A _Carole Dubois_ and _Eric Angelini_, Feb 02 2021

%E a(0) added by _Robert G. Wilson v_, Feb 21 2021

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 April 16 07:57 EDT 2024. Contains 371698 sequences. (Running on oeis4.)