# Problem dealing with the sum of digits of certain numbers.

$$N$$ is the smallest positive integer such that the sum of the digits of $$N$$ is 18 and the sum of the digits of $$2N$$ is $$27$$. Find $$N$$.

My workings so far:

If $$N$$ had two digits, then $$N$$ must equal $$99$$. However, the sum of the digits of $$99\times 2$$ does not equal $$27$$. Therefore, $$N$$ must have at least three digits.

Assume $$N$$ has three digits. Denote its digits by $$a, b, c, \dots$$ if their values are $$0, 1, 2, 3,$$ or $$4$$ $$(a\neq 0$$), and by $$A, B, C, \dots$$ if their values are $$5, 6, 7, 8,$$ or $$9$$.

The possibilities for $$N$$ are $$abc, abC, aBc, Abc, ABc, AbC, aBC,$$ or $$ABC$$. We can ignore the first four cases, as their maximum sum does not exceed 18. For the last four cases, 2N will respectively equal:

$$[1][2A-9][2B-10][2c], [1][2A-10][2b+1][2C-10], [2a+1][2B-9][2C-10],$$ and $$[1][2A-0][2B-9][2C-10]$$

(where square brackets represent individual digits)

Given these numbers, based on the fact that $$N$$'s digits add to 18, the digit sums of the above cases are $$18, 18, 18,$$ and $$9$$ respectively.

Suppose $$N$$ is a four-digit number....

I don't know how to continue from here. Maybe we could make a mock 'number' like above, but how would we calculate the digit sums of those cases?

Why can't $N$ be a three digit number?

Either $2N$ is a three digit number, or is four digit, with $1$ as it's first digit. If the first happens, then $2N = 999$, which can't happen. If the other happens, then $2N = 1abc$, where $a+b+c = 26$. We see the only possibility is that $a,b,c$ is $8,9,9$ in some order. Since $2N$ is even, $c = 8$, but then $N=999$, a problem.

Now, we basically need $N$ to be a four digit number, and $2N$ to have a digit sum of $27$. Since a digit sum of $27$ is harder to obtain, and $2N$ is a multiple of $18$, then we are better off going brute force with $2N$ rather than $N$.

Now, suppose that $2N$ has the first digit $2$, which is the smallest possible if $N$ has four digits. Then, the rest of the digits have to sum to $25$. This happens with $9,9,7$, and $9,8,8$. Now, since $2N$ is even, definitely we can rule out $9,9,7$, so that leaves $9,8,8$. This helps us form the number $2898$ and $2988$ as candidates for $2N$. For these, $N = 1449$ and $N = 1494$. Both these have digit sum $18$. The first one is smaller, hence is the answer : $N = 1449$.

If we double $N$ digitwise, i.e., without doing the carries, the resulting "virtual digit sum" is $36$. Each performed carry reduces this "virtual digit" sum by $9$. It follows that there is exactly one carry; hence $N$ has exactly one digit $>4$. Since $4+4+9<18$ the number $N$ has at least $4$ digits, and it is then obvious that $1449$ is the smallest number satisfying the conditions.

• Hi, what do you mean by doubling $N$ digitwise? For an $N$ with how many digits?
– user472341
Aug 28, 2017 at 8:18
• Replace the $r$-digit string $(a_{r-1}, a_{r-2},\ldots, a_0)$ encoding $\sum_{k=0}^{r-1} a_k10^k$ by $(2a_{r-1}, 2a_{r-2},\ldots, 2a_0)$. Aug 28, 2017 at 8:24