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

Let $a$, $b$, $c$ be positive integers and $s(a)$, $s(b)$, $s(c)$ denote the number of their digits (when the integers are written in decimal form) respectively. If,


$a + b + s(c) = c\qquad$


$4 + s(a) + s(b) + s(c) = b \qquad$

then what would be the possible values of $a$, $b$, $c$?

share|cite|improve this question
What do the dots mean in $a$...? – Gerry Myerson Oct 30 '12 at 12:01
If I ignore the dots, one solution is $a,b,c=2,8,12$. – Gerry Myerson Oct 30 '12 at 12:03
Note that combining the first and the second gives $s(a)+s(b)+s(c)+b=c$, so we have $4+c=2b$. That makes one variable disappear, and it implies that $s(b)-s(c)\in\{-1,0,1\}$. This gives 3 cases. – barto Oct 30 '12 at 12:46
up vote 4 down vote accepted

If $a$ is large, then (1) says that $b\approx10^a$; then (3) says that $c\approx10^{10^a}$, and then (2) can't work out. Thus $a$ can't be large. Then the same arguments applied to (2) and (3) show that $b$ also can't be large, and then the same argument applied just to (2) shows that $c$ can't be large, either. Thus there are only finitely many solutions.

To get rough bounds on the magnitudes, note that $s(x)\le1+x/10$. Thus from (1)

$$s(b)=a-s(a)\ge a-\left(1+\frac a{10}\right)=\frac9{10}a-1\;.$$

and hence

$$ b\ge10(s(b)-1)\ge9a-20\;. $$

Then substituting into (3) yields

$$ \begin{align} s(c) &=b-4-s(a)-s(b) \\ &\ge b-4-\left(1+\frac a{10}\right)-\left(1+\frac b{10}\right) \\ & =\frac9{10}b-\frac1{10}a-6 \end{align}$$

and hence

$$ c\ge10(s(c)-1)\ge9b-a-70\;. $$

But (2) yields

$$c=a+b+s(c)\le a+b+1+\frac c{10}$$

and thus


Together, this is



$$ 71b\le19a+640\;, $$


$$ 71(9a-20)\le19a+640\;, $$


$$ a\le\frac{103}{31}\lt4\;. $$

Since $a=1$ doesn't work in (1), that leaves $a=2$ or $a=3$. That implies $s(b)=1$ or $s(b)=2$, thus $b\le99$ and thus


Thus $s(c)\le3$, and then (3) yields $b\le10$, then (2) yields $c\le16$ and thus $s(c)\le2$, then (3) yields $b\le9$ and thus $s(b)=1$, which by (1) implies $a=2$. Now (3) becomes $b=6+s(c)$; that leaves only $b=7$ and $b=8$, and in both cases (2) yields $c\ge10$ and thus $s(c)=2$; then finally (3) yields $b=8$ and (2) yields $c=12$.

Thus the solution $a=2$, $b=8$, $c=12$ that Gerry found is the only solution.

share|cite|improve this answer
Nice solution. I think it's impossible to get there without estimating the values using powers of $10$. – barto Oct 30 '12 at 12:59
Wonderful solution , lately I have also found the same , I was having difficulty at first because I was using 10n ≥ 10^s(n) , though this is stronger than 10 + x ≥ 10 s(x) it did not help. – Souvik Dey Oct 31 '12 at 2:48
@Souvik: It's not strictly stronger -- your right-hand side is stronger, but my left-hand side is stronger, so the inequalities are incomparable. – joriki Oct 31 '12 at 3:48
@joriki: Not comparable? The inequalities are n ≥ 10( s(n) - 1) and n ≥ 10 ^( s(n) -1) , and since 10^k ≥ 10k for any non-negative integer k , the former follows readily from the later. – Souvik Dey Nov 1 '12 at 3:10

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.