Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How many seven-digit numbers divisible by 11 have the sum of their digits equal to 59?

I am able to get the seven-digit numbers divisible by 11


I am also able to get the seven-digit numbers whose sum of their digits equal to 59.

But i am not able to get how i can get the count of 7 digit numbers satisying both the condition.

Thanks in advance.

Thanks in advance.

share|cite|improve this question
up vote 3 down vote accepted

Since I promised vikiiii that I’d answer, here’s my version.

A number is divisible by $11$ if and only if the alternating sum of its digits is divisible by $11$. Say that the seven-digit number is $abcdefg$, where the letters represent the individual digits; then it’s divisible by $11$ if and only if $(a+c+e+g)-(b+d+f)$ is a multiple of $11$. Let $S=a+c+e+g$ and $T=b+d+f$; then we need $S-T$ to be a multiple of $11$ and $S+T=59$.

Since $S+T=59$, one of $S$ and $T$ must be odd and the other even, so their difference must be odd. Thus, $S-T$ cannot be $0$ or $\pm22$. We should look for ways to make it $\pm11$ or $\pm33$. (It clearly can’t be any bigger in magnitude, since $S\le 4\cdot9=36$.)

Suppose that $S-T=11$; then $70=11+59=(S-T)+(S+T)=2S$, so $S=35$ and $T=24$. This is possible only if three of the digits $a,c,e,g$ are $9$ and the fourth is $8$; there’s no other way to get four digits that total $35$. For three digits to total $24$, they must average $8$, so the only possibilities are that all three are $8$, that two are $9$ and one is $6$, or that they are $7,8$, and $9$. Thus, the digits $a,c,e,g$ in that order must be $8999,9899,9989$, or $9998$, and the digits $b,d,f$ must be $888,699,969,996,789,798,879,897,978$, or $987$, for a total of $4\cdot 10=40$ numbers.

Now suppose that $S-T=-11$; then by similar reasoning $2S=-11+59=48$, so $S=24$, and $T=35$. But $T\le 3\cdot9=27$, so this is impossible. Similarly, $S-T$ cannot be $-33$. The only remaining case is $S-T=33$. Then $2S=33+59=92$, and $S=46$, which is again impossible. Thus, the first case contained all of the actual solutions, and there are $40$ of them.

share|cite|improve this answer
M.Scott you are genius.Thanks so much.This is the best way.Thank you again. – vikiiii Mar 30 '12 at 15:13

If we look at the number $a_6a_5a_4a_3a_2a_1a_0$: $$a_6a_5a_4a_3a_2a_1a_0 = a_610^6+a_510^5+ \dots +a_010^0 \\ \equiv a_6(-1)^6 + \dots+a_0(-1)^0 \mod 11 = a_6 -a_5+a_4-a_3+a_2-a_1+a_0 \mod 11$$ So if the number will be divisible by 11 we require $$a_6 -a_5+a_4-a_3+a_2-a_1+a_0 = 11m$$

We take note that $0 \leq a_i \leq 9$ so possible values of $11m$ are limited to: $$-27 = 4\cdot0-3\cdot9\leq 11m \leq 4\cdot 9-3\cdot0 = 36$$ Which really means that $11m \in \{-22,-11,0,11,22,33\}$

The other requirement of the question was that $a_6 + \dots +a_0 = 59$. From this and the above equation (not sure how to number them and align them nicely in TeX) we add and subtract and get much nicer equations:

$$a_6 +a_4+a_2+a_0 = \frac{59+11m} 2 \\a_5+a_3+a_1 =\frac{ 59-11m}2$$

Of course the LHS is whole, so the right hand side must be as well, which means $m$ needs to be odd. So we reduce our options to:

$$11m \in \{-11,11,33\} \implies \frac{59+11m} 2 \in \{24,35,46\}$$ Of course the sum of four digits can't be $46$ from our above inequality on $a_i$, and similarly $$\frac{59-11m} 2 \in \{35,24\}$$ But the sum of three digits can't be $35$, so we're left with $$a_6 +a_4+a_2+a_0 = 35 \\a_5+a_3+a_1 =24$$

It's easy to see that the only options for the four digits is a permutation of $9998$, and the three digits must be a permutation of one of $\{699,789,888\}$.

Order doesn't matter, so basic combinatorics gives $4\cdot(3 + 3! + 1) = 40$ such numbers.

share|cite|improve this answer
Nice solution davin – juantheron Nov 8 '13 at 13:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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