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$.