Fix a prime number $p$. If $n$ is a positive integer, then denote
$$\text{$\omega\_{p,k}(n):=\#$ of $k$'s in the $p$-ary expansion of $n$}$$ 
and the total sum of all its $p$-ary digits by 
$$\Omega\_p(n):=\sum\_{k=0}^{p-1}k\cdot\omega\_{p,k}(n).$$



> 
> **Question.** Given a prime $p$ and for each $n\in\Bbb{N}$, is this true?
>  $$\prod\_{k=0}^{p-1}\left(\frac{X^{k+1}-Y^{k+1}}{X-Y}\right)^{\omega\_{p,k}(n)}
> =\sum\_{\Omega\_p(j)+\Omega\_p(n-j)=\Omega\_p(n)}^{0\leq j\leq n} X^{\Omega\_p(j)}\cdot\,\,Y^{\Omega\_p(n-j)}.$$
> 
> 
> 


**Example.** If $p=2$ and $s\_2(n)=\#$ the sum of binary digits of $n$, then
$$(X+Y)^{s\_2(n)}=\sum\_{s\_2(j)+s\_2(n-j)=s\_2(n)}^{0\leq j\leq n} X^{s\_2(j)}\cdot\,\,Y^{s\_2(n-j)}.$$



Polynomial expansions via prime-base digits
First we notice that the equality $\Omega\_p(a)+\Omega\_p(b)=\Omega\_p(a+b)$ happens if and only if there are no carries when adding $a+b$ in base $p$. Indeed the number of carries is equal to 
$$\frac{\Omega\_p(a)+\Omega\_p(b)-\Omega\_p(a+b)}{p-1}$$
which is also equal to $\nu\_p\left(\binom{a+b}{a}\right)$ by [Kummer's theorem](https://en.wikipedia.org/wiki/Kummer%27s_theorem). This is equivalent to saying that the base $p$ expansions of $a,b$
$$a=a\_0+a\_1p+a\_2p^2+\cdots , b=b\_0+b\_1p+b\_2p^2+\cdots$$
satisfy $a\_i+b\_i\le p-1$ for all $i$.


Consider the generating function 
$$F(X,Y,t)=\sum\_{n\geq 0}\left(\sum\_{\Omega\_p(j)+\Omega\_p(n-j)=\Omega\_p(n)}^{0\leq j\leq n} X^{\Omega\_p(j)}\cdot\,\,Y^{\Omega\_p(n-j)}\right)t^n$$
where the coefficient of $t^n$ is the right hand side of your identity. By the observation above this can also be written as
$$F(X,Y,t)=\sum\_{\Omega\_p(a)+\Omega\_p(b)=\Omega\_p(a+b)}t^{a+b}X^{\Omega(a)}Y^{\Omega(b)}$$
$$=\sum\_{a\_i+b\_i\le p-1}t^{a+b}X^{\sum a\_i}Y^{\sum b\_i}=\prod\_{i=1}^{\infty} \left(\sum\_{a\_i+b\_i\le p-1} X^{a\_i}Y^{b\_i}t^{(a\_i+b\_i)p^i}\right)$$
$$=\prod\_{i=1}^{\infty} \left(\sum\_{k=0}^{p-1}\left(\frac{X^{k+1}-Y^{k+1}}{X-Y}\right) t^{kp^i}\right)$$
from this last expression we see that the coefficient of $t^n$ is equal to $\prod\_{k=0}^{p-1}\left(\frac{X^{k+1}-Y^{k+1}}{X-Y}\right)^{\omega\_{p,k}(n)}$ which is the left hand side of our identity, as desired.


