Number of $1$'s in the ternary representation of $x$

91 Views Asked by At

Let $e(x)$ be the number of $1$'s in the ternary representation of $x$. Let $A(n)$ be the number of integers $x$ with $0 \leq x \leq 3^n$ such that $3 \mid e(x)$. Prove that $A(n)$ can be expressed in the form $$A(n) = \sum_{\mu \geq 0} c_n^{3 \mu} 2^{n-3\mu}.$$

I thought that $A(n) = 2^n+\binom{n}{3}2^{n-3}+\cdots$ by a counting argument. Where does the $c_n^{3 \mu}$ come from?

1

There are 1 best solutions below

0
On

Indeed, as you say,

$$A(n)=\sum_{k\geq 0}^{n/3} \binom n {3k} 2^{n-3k}$$

Since for any subset of $3k$ digits, there are $n-3k$ other digits, and therefore $2^{n-3k}$ numbers such that those $3k$ digits are $1$.

It's just that $C_n^{3k}$ is an alternative notation for $\binom n {3k}$.