login
A127971
a(n) = fusc(n+1) + (1-(-1)^n)/2, fusc = A002487.
2
1, 2, 2, 2, 3, 3, 3, 2, 4, 4, 5, 3, 5, 4, 4, 2, 5, 5, 7, 4, 8, 6, 7, 3, 7, 6, 8, 4, 7, 5, 5, 2, 6, 6, 9, 5, 11, 8, 10, 4, 11, 9, 13, 6, 12, 8, 9, 3, 9, 8, 12, 6, 13, 9, 11, 4, 10, 8, 11, 5, 9, 6, 6, 2, 7, 7, 11, 6, 14, 10, 13, 5, 15, 12, 18, 8, 17, 11, 13, 4
OFFSET
0,2
COMMENTS
Row sums of A127970.
LINKS
FORMULA
a(n) = (1-(-1)^n)/2 + Sum_{k=0..floor(n/2)} mod(C(n-k,k),2).
MATHEMATICA
Table[Sum[Mod[Binomial[n-k, k], 2], {k, 0, Floor[n/2]}] + (1-(-1)^n)/2, {n, 0, 50}] (* G. C. Greubel, May 04 2018 *)
PROG
(PARI) for(n=0, 50, print1((1-(-1)^n)/2 + sum(k=0, floor(n/2), lift(Mod( binomial(n-k, k), 2))), ", ")) \\ G. C. Greubel, May 04 2018
(Magma) [(1-(-1)^n)/2 + (&+[Binomial(n-k, k) mod 2: k in [0..Floor(n/2)]]) : n in [0..50]]; // G. C. Greubel, May 04 2018
(Python)
from functools import reduce
def A127971(n): return sum(reduce(lambda x, y:(x[0], x[0]+x[1]) if int(y) else (x[0]+x[1], x[1]), bin(n+1)[-1:2:-1], (1, 0)))+(n&1) # Chai Wah Wu, May 18 2023
CROSSREFS
Sequence in context: A295284 A292995 A037179 * A319290 A230516 A192688
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Feb 09 2007
STATUS
approved