cp's OEIS Frontend

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.

A338922 Every odd term k of the sequence is the cumulative sum of the odd digits used so far (the digits of k are included in the sum).

Original entry on oeis.org

1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 11, 32, 34, 36, 21, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 71, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Nov 15 2020

Keywords

Comments

This is the lexicographically earliest sequence of distinct positive terms with this property.

Examples

			a(1) = 1 as the sum of all odd digits used so far is 1:
a(2) = 2 as 2 is the smallest term not yet present in the sequence that doesn't lead to a contradiction;
a(3) = 4 as a(3) = 3 would be a contradiction and a(3) = 4 doesn't lead to a contradiction;
...
a(17) = 11 as the sum of all odd digits used so far is 11 (1 + 1 + 1 + 1 + 1 + 1 + 3 + 1 + 1); etc.
		

Crossrefs

Cf. A338923, A338924 and A338925 (variants on the same idea).

Programs

  • PARI
    my(v=[], S=0,p=2, n=1);while(n<100, c=0;for(q=S, p, if(q%2, m=0;for(i=1,#digits(q),if(digits(q)[i]%2,m+=digits(q)[i]));if(S+m==q&&!vecsearch(vecsort(v), q),v=concat(v, q);  S+=m; c++; break))); if(c==0, for(j=1,#digits(p),if(digits(p)[j]%2,S+=digits(p)[j])); v=concat(v, p); p+=2); n++); v \\ Derek Orr, Nov 22 2020