OFFSET
0,3
COMMENTS
From M. F. Hasler, Dec 06 2022: (Start)
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.
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.
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.
We have the following properties:
1) If the sum of all odd digits up to a(n) has only even digits, then a(n+1) equals that sum.
2) An even term a(n) can never be immediately followed by a term a(n+1) with only even digits.
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, ...).
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)
LINKS
Carole Dubois, Table of n, a(n) for n = 0..5001
Eric Angelini, Cumulative sum of odd digits, "Cinquante Signes" on blogspot.com, Dec 06 2022
EXAMPLE
The 1st nonzero even term is 4 and 4 is the sum of the odd digits so far, 1 and 3;
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);
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);
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.
PROG
(Python)
def A357051_first(N=100):
S = []; used_even = set(); next_odd = 1; sod = 0 # sum of odd digits (so far)
for n in range(N):
x = sod + sod % 2; lim = sod + 9*len(str(x)); sodx = A071649(x)
while x < lim:
if x == sod + sodx and x not in used_even:
used_even |= { x } ; break
x += 2
if x % 10 == 0:
sodx = A071649(x)
if sodx == 1: lim += 9
else: x = next_odd; next_odd += 2; sodx = A071649(x)
S += [ x ] ; sod += sodx
return S
# M. F. Hasler, Dec 06 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Dec 26 2020
STATUS
approved