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!)
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. 1
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, 102, 31, 33, 114, 116, 118, 35, 130, 134, 138, 37, 154, 39, 174, 41, 43, 45, 184, 194, 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 (list; graph; refs; listen; history; text; internal format)
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
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
Cf. A005408 (odd numbers), A071649 (sum of odd decimal digits of n).
Sequence in context: A086186 A365578 A014463 * A161983 A047364 A274519
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Dec 26 2020
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 April 18 20:21 EDT 2024. Contains 371781 sequences. (Running on oeis4.)