+0

# Counting

0
42
2

Find the number of positive integers that satisfy both the following conditions:

Each digit is a 1 or a 2

The sum of the digits is 3

Mar 6, 2023

#1
+195
0

Let $n$ be a positive integer satisfying the given conditions, and let $a$ be the number of 1's in the base-2 representation of $n.$ Then $n$ has $3-a$ 2's in its base-2 representation. Since $n$ has a sum of digits of 3, we know that $a + (3-a)\cdot 2 = 3,$ or $a = 3.$ Thus, $n$ must have three 1's and no 2's in its base-2 representation.

Conversely, any positive integer with three 1's and no 2's in its base-2 representation is a solution to the given conditions. There are $\binom{3}{0} = 1$ ways to place zero 2's among three 1's, so the number of positive integers that satisfy the conditions is $\boxed{1}.$

Mar 6, 2023
#2
0

12,  21,  111 ==3 such integers !

Mar 6, 2023