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.
%I A340015 #18 Dec 21 2024 20:14:15 %S A340015 0,1,3,4,5,10,7,18,9,30,11,13,15,42,17,19,60,21,23,64,25,76,27,92,29, %T A340015 102,31,33,114,116,118,35,130,134,138,37,154,39,174,41,43,45,184,194, %U A340015 47,49,51,53,224,55,57,246,59,260,61,63,264,65,276,67,292,69,304,71,316,73,332,338,75,358,77,79,81,83,85,87,404,89,414,91 %N A340015 a(n) is the least even number not used earlier and equal to the sum of the odd digits of the terms up to and including a(n), if such a number exists; otherwise, a(n) is the least odd number not occurring earlier. %C A340015 From _M. F. Hasler_, Dec 06 2022: (Start) %C A340015 From the definition it is immediate that any even term is equal to the sum of all odd digits in the sequence up to that term. %C A340015 Also, the subsequences of terms of given parity are both strictly increasing: The odd terms give exactly the sequence of all odd numbers, A005408, and any even number not occurring before a given even a(n) (e.g., 2, 6, 8, 12, 14, 16, ...) will never occur in the sequence. %C A340015 The search space to check whether an even number can extend the sequence is bounded because using a number with more digits can increase the sum of digits by at most 9 per digit, while the number itself becomes (roughly) 10 times larger with each additional digit. %C A340015 We have the following properties: %C A340015 1) If the sum of all odd digits up to a(n) has only even digits, then a(n+1) equals that sum. %C A340015 2) An even term a(n) can never be immediately followed by a term a(n+1) with only even digits. %C A340015 3) An even term a(n) can be followed by another even term a(n+1) if the sum of the odd digits of a(n+1) is equal to a(n+1) - a(n), as for example at (..., 114, 116, 118, ...) and (..., 130, 134, 138, ...). %C A340015 4) If a(n) is even and s = (sum of the odd digits of a(n)) can be added to a(n) without changing any of a(n)'s odd digits and leaving a(n)'s even digits even, then a(n+1) <= a(n) + s. (There may be a smaller solution a(n+1) whose sum of odd digits is smaller than s.) (End) %H A340015 Carole Dubois, <a href="/A340015/b340015.txt">Table of n, a(n) for n = 0..5001</a> %H A340015 Eric Angelini, <a href="http://cinquantesignes.blogspot.com/2022/12/cumulative-sum-of-odd-digits_6.html">Cumulative sum of odd digits</a>, "Cinquante Signes" on blogspot.com, Dec 06 2022 %H A340015 Eric Angelini, <a href="/A340015/a340015.pdf">Cumulative sum of odd digits</a>, "Cinquante Signes" on blogspot.com, Dec 06 2022 [Cached copy] %e A340015 The 1st nonzero even term is 4 and 4 is the sum of the odd digits so far, 1 and 3; %e A340015 The 2nd even term is 10 and 10 is the sum of 1+3+5+1 (the last 1 being the 1 of 10 itself); %e A340015 The 3rd even term is 18 and 10 is the sum of 1+3+5+1+7+1 (the last 1 being the 1 of 18 itself); %e A340015 The 4th even term is 30 and 30 is the sum of 1+3+5+1+7+1+9+3 (the last 3 being the 3 of 30 itself); etc. %o A340015 (Python) %o A340015 def A357051_first(N=100): %o A340015 S = []; used_even = set(); next_odd = 1; sod = 0 # sum of odd digits (so far) %o A340015 for n in range(N): %o A340015 x = sod + sod % 2; lim = sod + 9*len(str(x)); sodx = A071649(x) %o A340015 while x < lim: %o A340015 if x == sod + sodx and x not in used_even: %o A340015 used_even |= { x } ; break %o A340015 x += 2 %o A340015 if x % 10 == 0: %o A340015 sodx = A071649(x) %o A340015 if sodx == 1: lim += 9 %o A340015 else: x = next_odd; next_odd += 2; sodx = A071649(x) %o A340015 S += [ x ] ; sod += sodx %o A340015 return S %o A340015 # _M. F. Hasler_, Dec 06 2022 %Y A340015 Cf. A338741, A338742, A338743, A338744, A338745, A338746. %Y A340015 Cf. A005408 (odd numbers), A071649 (sum of odd decimal digits of n). %K A340015 base,nonn %O A340015 0,3 %A A340015 _Eric Angelini_ and _Carole Dubois_, Dec 26 2020