login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A214126
a(2n)=a(n-1)+a(n) and a(2n+1)=a(n+1) for n>=1, with a(0)=a(1)=1.
2
1, 1, 2, 2, 3, 2, 4, 3, 5, 2, 5, 4, 6, 3, 7, 5, 8, 2, 7, 5, 7, 4, 9, 6, 10, 3, 9, 7, 10, 5, 12, 8, 13, 2, 10, 7, 9, 5, 12, 7, 12, 4, 11, 9, 13, 6, 15, 10, 16, 3, 13, 9, 12, 7, 16, 10, 17, 5, 15, 12, 17, 8, 20, 13, 21, 2, 15, 10, 12, 7, 17, 9, 16, 5, 14, 12
OFFSET
0,3
COMMENTS
a(2^n) = A000045(n+2), a(2^n-1) = A000045(n+1). - Alois P. Heinz, Jul 06 2012
LINKS
FORMULA
a(0) = a(1) = 1, for n>=1: a(2*n) = a(n-1)+a(n) and a(2*n+1) = a(n+1).
EXAMPLE
a(2^n+1) = 2 because a(2) = 2 and a(2*n+1) = a(n+1).
MAPLE
a:= proc(n) local r;
a(n):= `if`(n<2, 1, `if`(irem(n, 2, 'r')=0, a(r-1)+a(r), a(r+1)))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Jul 06 2012
MATHEMATICA
a[0] = a[1] = 1;
a[n_] := a[n] = If[EvenQ[n], a[n/2-1] + a[n/2], a[(n-1)/2+1]];
Array[a, 100, 0] (* Jean-François Alcover, May 31 2019 *)
PROG
(Python)
a = [1]*(77*2)
for n in range(1, 77):
a[2*n ]=a[n-1]+a[n]
a[2*n+1]=a[n+1]
print(str(a[n-1]), end=', ')
CROSSREFS
Cf. A120562: same formula, seed {0,1}, first term removed.
Cf. A082498: same formula, seed {1,0}, first term removed.
Cf. A214127: same formula, seed {1,2}.
Cf. A000045.
Sequence in context: A360179 A361511 A345147 * A205378 A323889 A286378
KEYWORD
nonn,easy
AUTHOR
Alex Ratushnyak, Jul 04 2012
STATUS
approved