Good morning, everyone. Here is the problem I'm faced with:

The sum of the number $n$ and the digits of $n$ equals $313$. What are the possible values of $n$?

By reasoning I concluded that it has to be a $3$ digit number and by hit and trial I found $305$ as one of the answers. How would I find all possible values of $n$?

It would be great if someone could throw light on how to proceed in a mathematical way and get the values of $n$ (as opposed to brute-forcing/trial-and-error).

I tried as below:

Let our number be $xyz$, where $x,y,z$ are the digits of the number. Then we seek solutions to

$$\underbrace{100x + 10y + z}_{n} + \underbrace{x+y+z}_{n's \; digits} = 313$$

Thus, simplifying, we seek integer solutions to

$$101 x + 11 y + 2 z = 313$$

I am stuck now as to how to solve this.

Thanks to all in advance.


Going from your final conclusion,

$$101x + 11y + 2z = 313$$

it seems sufficient to simply notice that $x,y,z \in \{0,1,2,3,...,9\}$ since the number's digits are $x,y,z$. In particular, we can eliminate further: we must have $x \in \{1,2\}$ since the maximum value of $11y+2z=117$ (when you have $y=z=9$). The least value of $11y+2z$ is obviously $0$, so with the previous we know:

$$x \in \{1,2,3\}$$

From here, it becomes more processes of elimination.

Suppose $x=1$. Then $11y+2z = 313-101 = 212$. However the maximum value noted earlier for the former expression is $117$, so the one's digit ($x$) definitely cannot be $1$.

Suppose $x=2$. Then $11y + 2z = 313 - 202 = 111$.

Try $y=9$. This yields $z=6$.

Try $y=8$, which yields $z = 11.5 > 10$, so we can immediately conclude that $z=2,y=9$ is the only solution here. We need not try more $y$'s.

Suppose $x=3$. then $11y + 2z = 313 - 303 = 10$.

As is easily deducible, this immediately implies $y=0$ and $z=5$. Thus, that would be the only solution to this case.

Thus, we end up with two solutions:

$$x=3,y=0,z=5 \implies 305 \; \text{ is a solution} $$ $$x=2,y=9,z=6 \implies 296 \; \text{ is a solution} $$

Throw in some details to show numbers with fewer than $3$ or more than $3$ digits cannot be solutions (should be pretty easy), and you have thus shown these are the only base-$10$ solutions to

$$n + s(n) = 313$$

where $s(n)$ denotes the sum of the digits of $n$.


The greatest possible sum of digits for a positive integer less than $313$ is $20$ (from $299$) so the minimum value you need to test is $293$. The sum of digits in this range is at least $3$ ($300$) and is at least $4$ for numbers other than $300$ so the greatest number you need to test is $309$

Either you are less than $300$ when, with units digit $a$ you have $290+2a+11=313$ and $a=6$, or greater than $300$ when $300+2a+3=313$, and $a=5$.


You are on the right track with: $$\overline{xyz}+x+y+z=101x+11y+2z=313.$$ $x\ne 1$, because otherwise $11y+2z\le 117<212$.

$x=2$, then: $$z=\frac{111-11y}{2} \Rightarrow y=9, z=6 \Rightarrow \overline{xyz}=296.$$



where $x,y,z$ are numbers between $0$ and $9$.

If $x\le 1$, then $101x+11y + 2z \le 101+11(9)+2(9)=101+13(9)=218 $

If $x=2$, then we have $$11y+2z=111$$

Since $z\le 9$, we have $$11y =111-2z \ge 93$$

Hence, we must have $y=9$. $$2z=111-11(9)=111-99=12.$$

Hence $296$ is a solution.

If $x=3$, then we have $11y+2z=10$ which forces $y=0, z=5$.

The solutions are $305$ and $296$.


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.