Let m be a positive integer and $$b_{m}(n)$$
b
m
(
n
)
be the number of partitions of a non-negative integer n with parts being powers of 2, where each part can take m colors. We show that if $$m=2^{k}-1$$
m
=
2
k
-
1
, then the natural density of n such that $$b_{m}(n)$$
b
m
(
n
)
cannot be represented as a sum of three squares exists, and equals 1/12 for $$k=1, 2$$
k
=
1
,
2
and 1/6 for $$k\ge 3$$
k
≥
3
. In particular, for $$m=1$$
m
=
1
the equation $$b_{1}(n)=x^2+y^2+z^2$$
b
1
(
n
)
=
x
2
+
y
2
+
z
2
has a solution in integers if and only if n is not of the form $$2^{2k+2}(8s+2t_{s}+3)+i$$
2
2
k
+
2
(
8
s
+
2
t
s
+
3
)
+
i
for $$i=0, 1$$
i
=
0
,
1
and k, s are non-negative integers, and where $$t_{n}$$
t
n
is the nth term in the Prouhet–Thue–Morse sequence. A similar characterization is obtained for the solutions in n of the equation $$b_{2^k-1}(n)=x^2+y^2+z^2$$
b
2
k
-
1
(
n
)
=
x
2
+
y
2
+
z
2
.