OFFSET
0,2
COMMENTS
Row sums of A127970.
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..10000
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
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Feb 09 2007
STATUS
approved