OFFSET
1,2
COMMENTS
a(n) is n plus the number of 2's in A293630 on the interval 1..n.
LINKS
Iain Fox, Table of n, a(n) for n = 1..10369
FORMULA
EXAMPLE
A293630 begins 1, 2, 1, 1, 1, 2, 1, 1, 2, ... so:
a(1) = 1.
a(2) = 1 + 2 = 3.
a(3) = 1 + 2 + 1 = 4.
a(4) = 1 + 2 + 1 + 1 = 5.
...
MATHEMATICA
Accumulate@ Nest[Join @@ {#, Join @@ ConstantArray[Most@ #, Last@ #]} &, {1, 2}, 5] (* Michael De Vlieger, Jan 22 2018 *)
PROG
(PARI) lista(nn) = my(v=[1, 2], l, w, s=0); for(n=1, nn, l=length(v); w=vector(l-1, i, v[i]); v=concat(v, if(v[l]-1, concat(w, w), w))); for(i=1, length(v), s += v[i]; print1(s, ", "))
CROSSREFS
KEYWORD
nonn
AUTHOR
Iain Fox, Jan 22 2018
STATUS
approved