OFFSET
1,2
LINKS
T. D. Noe, Table of n, a(n) for n = 1..1000
J. M. Dover, On two OEIS conjectures, arXiv:1606.08033 [math.CO], 2016.
FORMULA
a(n) = n + Sum_{k=1..n-1} A022907(k), n > 1. [corrected by Sean A. Irvine, May 22 2019]
MATHEMATICA
(* b = A022905 *) b[1] = 1; b[n_] := b[n] = b[n-1] + 1 + If[EvenQ[n], 2 b[n/2], b[(n-1)/2] + b[(n+1)/2]];
a[1] = 0; a[n_] := b[n-1] + 1;
Array[a, 50] (* Jean-François Alcover, Nov 11 2018 *)
PROG
(Python)
from itertools import islice
from collections import deque
def A022908_gen(): # generator of terms
aqueue, f, b, a = deque([2]), True, 1, 2
yield from (0, 2)
while True:
a += b
aqueue.append(a)
if f:
yield (3*a+1)//2
b = aqueue.popleft()
f = not f
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved