OFFSET
0,5
COMMENTS
In rows 2^k - 1 all entries are odd.
a(n) = 0 (all the entries in the row are odd) iff n = 2^m - 1 for some m >= 0 and then n belongs to sequence A000225. - Avi Peretz (njk(AT)netvision.net.il), Apr 21 2001
Also number of zeros in n-th row of Sierpiński's triangle (cf. A047999): a(n) = A023416(A001317(n)). - Reinhard Zumkeller, Nov 24 2012
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..10000 (terms 0..1000 from T. D. Noe)
FORMULA
a(n) = n+1 - A001316(n) = n+1 - 2^A000120(n) = n+1 - Sum_{k=0..n} (C(n, k) mod 2) = Sum_{k=0..n} ((1 - C(n, k)) mod 2).
a(2n) = a(n) + n, a(2n+1) = 2a(n). - Ralf Stephan, Oct 07 2003
A249304(n+1) = a(n+1) + a(n). - Reinhard Zumkeller, Nov 14 2014
G.f.: 1/(1 - x)^2 - Product_{k>=0} (1 + 2*x^(2^k)). - Ilya Gutkovskiy, Jul 19 2019
EXAMPLE
Row 4 is 1 4 6 4 1 with 3 even entries so a(4)=3.
MATHEMATICA
Table[n + 1 - Sum[ Mod[ Binomial[n, k], 2], {k, 0, n} ], {n, 0, 100} ]
a[n_] := n + 1 - 2^DigitCount[n, 2, 1]; Array[a, 100, 0] (* Amiram Eldar, Jul 27 2023 *)
PROG
(PARI) a(n)=if(n<1, 0, if(n%2==0, a(n/2)+n/2, 2*a((n-1)/2)))
(Haskell)
import Data.List (transpose)
a048967 n = a048967_list !! n
a048967_list = 0 : xs where
xs = 0 : concat (transpose [zipWith (+) [1..] xs, map (* 2) xs])
-- Reinhard Zumkeller, Nov 14 2014, Nov 24 2012
(Python)
def A048967(n): return n+1-(1<<n.bit_count()) # Chai Wah Wu, May 03 2023
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
STATUS
approved