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.
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
Offset: 0
Examples
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.
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
- Eric Angelini, Cumulative sum of odd digits, "Cinquante Signes" on blogspot.com, Dec 06 2022 [Cached copy]
Crossrefs
Programs
-
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
Comments