1
$\begingroup$

I am reading Mathematical Circle. Problem $48$ in chapter two says that

How many nine-digit numbers have an even sum of their digits?

I am trying in this way, that we can divide the problem in four cases.

  1. $1$ even digit and $8$ odd digits
  2. $3$ even digits and $6$ odd digits
  3. $5$ even digits and $4$ odd digits
  4. $7$ even digits and $2$ odd digits

For the first case we get $4 \cdot 5^8 +5\cdot 5^7 \cdot 5$ number of solution. Because if the even digit is placed in first place (left to right) then we get $4\cdot 5^8$ ways to write the number and if an odd digit is placed in first place then we get $5\cdot 5^7 \cdot 5$ ways to write the number. Similarly for the second case we get $4\cdot 5^8+5^9$ , for the third case we get $4\cdot 5^8+5^9$ and for the fourth case we get $4\cdot 5^8+5^9$ ways to write the number. So total number is $ 4 \cdot (4\cdot 5^8+5^9)$. The answer is different. So Where I have made a mistake? Thanks.

$\endgroup$
  • 1
    $\begingroup$ I'd just look at the last digit. $\endgroup$ – Lord Shark the Unknown Jul 23 at 7:11
  • $\begingroup$ @LordSharktheUnknown That would not suffice. $\endgroup$ – uniquesolution Jul 23 at 7:14
  • $\begingroup$ @uniquesolution I beg to differ.... $\endgroup$ – Lord Shark the Unknown Jul 23 at 7:18
  • $\begingroup$ @LordSharktheUnknown For every choice of a last digit, there is a nine-digit number ending with that particular choice, whose sum of digits is odd, and there is another one ending with that particular digit, whose sum of digits is even, don't you agree? $\endgroup$ – uniquesolution Jul 23 at 7:19
  • $\begingroup$ @uniquesolution. For every nine-digit number, fix the 8-digit prefix, now play with the last digit. I think only need to count for those starting with 0. $\endgroup$ – dEmigOd Jul 23 at 7:26
5
$\begingroup$

There are $900000000$ nine-digits numbers and exactly half of them have an even sum of digits (because every number can be paired with another of the opposite parity by changing the last digit).

$\endgroup$
2
$\begingroup$

This is an unnecessarily complex solution but shows some combinatorial techniques.

First, we'll count the number of (ordered) sequences of 9 digits where the sum of the digits is even. Then we will subtract the number of such sequences whose first digit is zero.

If the sum of the digits in the 9-digit sequence is even, then we must have an even number of odd digits (which can be 0, 2, 4, or 8). The number of such sequences is:

$$\sum_{n=0,2,4,6,8} {9 \choose n}\times{5^n}\times{5^{9-n}} =\sum_{n=0,2,4,6,8} {9 \choose n}\times{5^9}$$ Among these sequences, the number of the ones that start with $0$ making them non-9-digit numbers is: $$\sum_{n=0,2,4,6,8} {8 \choose n}\times{5^8} $$ So the total number of 9-digit numbers whose sum of digits is even is: $${5^8}\times\sum_{n=0,2,4,6,8} 5{9 \choose n}-{8 \choose n} = 450000000$$

$\endgroup$
0
$\begingroup$

Let $A$ be the set of nine digit numbers. Its size is $|A|=9\cdot10^8$: we're free to choose eight digits among all ten digits, but the most significant digit can't be zero.

Now consider the following map $f\colon A\to A$: $$ f(x)=\begin{cases} x-9 & x\equiv 9\pmod{10} \\[4px] x+1 & x\not\equiv9\pmod{10} \end{cases} $$ The map is bijective. If $A_0$ and $A_1$ denote the subsets of $A$ consisting of numbers with even or, respectively, odd digit sum, we can see that $f$ induces bijective maps $f_{01}\colon A_0\to A_1$ and $f_{10}\colon A_1\to A_0$.

Therefore $|A_0|=|A|/2=45\cdot10^7$.

$\endgroup$
0
$\begingroup$

$9$ digit numbers range from $10^8$ to $10^{9}-1$. There are exactly $9 \cdot 10^8$ numbers, that have nine digits.

$10^8 + 0$ doesn't have an even sum of its digits $(=1)$.

$10^8+1$ has an even sum of its digits $(=2)$.

$10^8+2$ doesn't have an even sum of its digits $(=3)$.

$10^8+3$ has an even sum of its digits $(=4)$.

$10^8+4$ doesn't have an even sum of its digits $(=5)$.

$10^8+5$ has an even sum of its digits $(=6)$.

$10^8+6$ doesn't have an even sum of its digits $(=7)$.

$10^8+7$ has an even sum of its digits $(=8)$.

$10^8+8$ doesn't have an even sum of its digits $(=9)$.

$\vdots \hspace{3cm} \vdots \hspace{3cm} \vdots$

$10^9-3$ has an even sum of its digits$(=-2)$.

$10^9-2$ doesn't have an even sum of its digits $(=-1)$.

$10^9-1$ has an even sum of its digits $(=0)$.

See the pattern? Here is a C++ Code that finds that out for you:

int main()
{
    unsigned long int x;
    x = 0;
    for(unsigned long int i = 100000000; i <= 1000000000-1; i++)
        if (i % 2 == 0)
            x++;
    std::cout << x;
}

This yields $x = (9 \cdot 10^8)/2 = 45\cdot 10^7$. Half of the numbers with nine digits have an even digit sum.

$\endgroup$
  • $\begingroup$ $0$ is not a nine-digits number… $\endgroup$ – Yves Daoust Jul 23 at 8:13
  • $\begingroup$ Beware that you stop the iterations one number too early so that the answer might be wrong. $\endgroup$ – Yves Daoust Jul 23 at 8:17
  • $\begingroup$ Ok, I've corrected my answer, thank you. $\endgroup$ – Ahmed Hossam Jul 23 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.