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.

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

Original entry on oeis.org

0, 1, 2, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 10, 12, 29, 31, 33, 35, 37, 39, 41, 20, 43, 45, 47, 49, 40, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 70, 71, 72, 73, 75, 77, 79, 80, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 130
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Nov 15 2020

Keywords

Comments

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

Examples

			a(1) = 0 as 0 is the sum of all even digits used so far:
a(2) = 1 as 1 is the smallest term not yet present in the sequence that doesn't lead to a contradiction;
a(3) = 2 as 2 is the sum of all even digits used so far (0 + 2);
a(4) = 3 as 3 is the smallest term not yet present in the sequence that doesn't lead to a contradiction;
...
a(17) = 10 as 10 is the sum of all even digits used so far (0 + 2 + 2 + 2 + 2 + 2 + 0);
a(18) = 12 as 12 is the sum of all even digits used so far (0 + 2 + 2 + 2 + 2 + 2 + 0 + 2);
a(19) = 29 as 29 is the smallest term not yet present in the sequence that doesn't lead to a contradiction; etc.
		

Crossrefs

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

Programs

  • PARI
    my(v=[], S=0,p=1, 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