I was looking at the pattern of odd entries in Pascal’s triangle and noticed that every row contains an even count of odd numbers. This is easy to justify, but it led me to wonder how the exact count of odd entries behaves from row to row, and whether any closed formulas or structural results are known.
Let $$ a_n=\sum_{k=0}^n f\!\left(\binom{n}{k}\right),\qquad f(m)= \begin{cases} 0 & \text{if } m \text{ is even},\\ 1 & \text{if } m \text{ is odd}. \end{cases} $$ Thus $a_n$ counts the odd entries in row $n$ of Pascal’s triangle.
Notes on the sequence $a_n$:
- for $n>0$ $a_{2^n}=2$
- $a_{n}>2$ for $n$ which isn't a power of $2$
Both of these follows from this post.
I am interested in the following questions:
Is there a closed form for $a_n$?
I suspect that no simple exact formula exists.Is it true that $a_n$ is always a power of $2$?
Empirically this appears to hold for all $n\le 1000$ (checked by computer), but I have not been able to prove it.Does the sequence $(a_n)$ contain a divergent subsequence?
Here is a simple but not so effecient python code to find $a_n$
import math
a=[1,2]
def f(n):
if n%2==0:
return 0
else:
return 1
for i in range (2,5000+1):
s=0
for j in range (0,i+1):
s=s+f(math.comb(i,j))
a.append(s)
print(a)