# $n$ has digit sum 100; $2n$ has digit sum 110

My question is:

A $$n$$-digit number is given whose digit sum is $$100$$, the number when doubled gives digit sum as $$110$$ then what is this $$n$$-digit number?

My approach:

I assumed $$n$$-digits to be $$x_{1},x_{2},\cdots x_{n}$$ and $$n$$-digits after doubling the original number to be $$y_{1},y_{2},\cdots y_{n}$$, so the equation comes out to be,

$$\sum_{i=1}^{n}x_{i}=100$$ And another equation,

$$\sum_{i=1}^{n}y_{i}=110$$

I'm not able to proceed futher after this.

• Surely the $y$'s stand in some relationship to the $x$'s. Also, couldn't the doubled number have $n+1$ digits? In fact, you know that there are going to be carryovers when you add the number to itself, or else the sum of the digits of the doubled number would be $200$ – Bram28 Nov 4 '18 at 13:48
• $9999999999442$ is one solution. – Parcly Taxel Nov 4 '18 at 13:50
• @Bram28 Surely, it can have more than $n$-digits after doubling. – Sahil Silare Nov 4 '18 at 13:51
• @ParclyTaxel And so $99999999994420$ would be as well .... And $9999999999424$ .. and $999999999922222$ ... and ... So not a very nice problem given multiple solutions – Bram28 Nov 4 '18 at 13:52
• $2,449,999,999,999$ is a solution and I suspect this is the smallest one. – achille hui Nov 4 '18 at 14:06

Any number comprised of repeating $$4$$s and $$5$$s will be the same sum when doubled. We then just need a series of digits that when doubled adds $$10$$.

$$4545454545454545454522222$$ will do it.

The number $$999999999922222$$ satisfies the required condition.

I got to this number by noting that:

1. If you multiply any multiple of $$9$$ by $$2$$, the sum of digits remains the same.

2. If you multiply any number containing all digits less than $$5$$ by $$2$$, then the sum of digits doubles.

Therefore, in the above number, on doubling, the sum of the digits of the first part containing $$10$$ $$9$$'s remains the same, and the second part which contains only $$2$$s, sees its sum of digits doubled. So the new sum of digits will be $$110$$.

A number with 10 fives followed by fifty ones will do. Obviously it is not a small number as some have already given, but thought of posting it as a simple solution. Actually any arrangement of these should also work and you may throw in any amount of zeroes too.

For any $$n$$-digit integer $$a$$, let $$[a_{n-1} a_{n-2} \cdots a_1 a_0 ]$$ be its decimal representation. i.e. an ordered list of numbers $$a_{n-1}, \ldots, a_0$$ from $$\{ 0, \ldots, 9 \}$$ such that $$a = \sum_{k=0}^{n-1} a_k \times 10^k$$ Let $$X(a) \stackrel{def}{=} \sum\limits_{k=0}^{n-1} a_k$$ be its sum of digits.

When we add two numbers $$a = [a_{n-1} \cdots a_0 ]$$, $$b = [b_{n-1} \cdots b_0 ]$$, the digits of its sum $$d = [d_n d_{n-1} \cdots d_0 ]$$ can be determined by following algorithm.

1. init carry $$c$$ to $$0$$ and index $$k$$ to $$0$$.
2. compute $$v = a_k + b_k + c$$. if $$v \ge 0$$, set $$d_k$$ to $$v - 10$$ and $$c$$ to $$1$$ otherwise, set $$d_k$$ to $$v$$ and $$c$$ to $$0$$.
3. increase $$k$$ by $$1$$. If $$k < n$$ repeat step 2. otherwise set $$d_{n}$$ to carry $$c$$.

As one can see, everytime a carry is triggered at step 2. the sum of digits for $$d$$ will be decreased by $$9$$. From this, we can deduce

$$X(a) + X(b) - X(a+b) = 9 \times \text{ number of carries triggered in step 2 }$$

When $$a = b$$, it is easy to see a carry will be triggered when and only when $$a_k = b_k$$ is a digit $$\ge 5$$. This implies

$$2X(a) - X(2a) = 9 \times \text{ number of } a_k \ge 5$$

For the given $$n$$-digit integer, let call it $$m$$, we known $$X(m) = 100$$ and $$X(2m) = 110$$. This implies it contains $$\frac{2\cdot 100 - 110}{9} = 10$$ digits $$\ge 5$$. If we want $$m$$ to be as small as possible, we will make all these $$10$$ digits to be $$9$$ and push them to the slot of $$a_0,\ldots,a_9$$. The account for $$90$$ out of $$100$$ in the sum $$X(m)$$. We are left with digits $$\le 4$$ to cover them. The smallest possible choice is pushing $$2,4,4$$ to $$a_{12},a_{11},a_{10}$$.

In short, the $$13$$-digit number $$m = 2,449,999,999,999$$ is a solution (in fact the smallest solution) of the problem.

It's easy to see that the $$30$$-digit number

$$145{,}145{,}145{,}145{,}145{,}145{,}145{,}145{,}145{,}145$$

has digit sum $$100$$, while its double,

$$290{,}290{,}290{,}290{,}290{,}290{,}290{,}290{,}290{,}290$$

has digit sum $$110$$.

Added later: Following up on Christian Blatter's answer, let $$N$$ be any number, let its digit sum be $$S(N)$$, and let $$m$$ be the number of digits in $$N$$ that are greater than or equal to $$5$$. Let $$N'$$ be the number in which each of those $$m$$ digits is decreased by $$5$$ (so that each digit of $$N'$$ is between $$0$$ and $$4$$. Then clearly $$S(N)=S(N')+5m$$. But we also have $$S(2N)=2S(N')+m$$, since we can obtain $$2N$$ by adding the $$m$$ carried $$1$$'s to the appropriate digits of $$2N'$$, none of which are greater than $$8$$ (so there are no additional carries). It follows that

$$2S(N)-S(2N)=9m$$

So if $$S(N)=100$$ and $$m=10$$, we have $$S(2N)=2S(N)-9m=2\cdot100-9\cdot10=110$$, and if $$S(N)=100$$ and $$S(2N)=110$$, we have

$$m={2S(N)-S(2N)\over9}={2\cdot100-110\over9}=10$$

One general method for dealing with this problem is as follows. Let $$r$$ be the number whose $$n$$ digits are $$d_{n-1},\ldots, d_3,d_2,d_1,d_0\in\{9,8,7,6,5,4,3,2,1,0\}$$. Then $$r= d_{n-1}\cdot 10^{n-1}+d_{n-2}\cdot 10^{n-2}+\ldots+d_1\cdot 10^1+d_0\cdot 10^0=\sum_{k=0}^{n-1}d_k\cdot 10^k$$ Set $$I_i=\{k_i\in \mathbb{N}:0\leq k_i\leq n-1, d_{k_i}=i\}$$. Let $$m_i=|I_i|$$. Then \begin{align} r=& 1 \cdot \sum_{k_1\in I_1}10^{k_i} + 2 \cdot \sum_{k_2\in I_2}10^{k_2} + 3 \cdot \sum_{k_3\in I_3}10^{k_3} + 4 \cdot \sum_{k_4\in I_4}10^{k_4} \\ &+5 \cdot \sum_{k_5\in I_5}10^{k_5} + 6 \cdot \sum_{k_6\in I_6}10^{k_6} + 7 \sum_{k_7\in I_7}10^{k_7} \\ &+ 8\cdot \sum_{k_8\in I_8}10^{k_8} +9\cdot \sum_{k_9\in I_9}10^{k_9} \end{align} and $$1\cdot m_1+2\cdot m_2+3\cdot m_3+4\cdot m_4+5\cdot m_5+6\cdot m_6+7\cdot m_7+8\cdot m_8+9\cdot m_9=100 \\ m_0+m_1+m_2+m_3+m_4+m_5+m_6+m_7+m_8+m_9=n$$ Multiplying the number $$r$$ by $$2$$ we have \begin{align} 2r=& 2 \cdot \sum_{k_1\in I_1}10^{k_i} \\ +& 4 \cdot \sum_{k_2\in I_2}10^{k_2} \\ +& 6 \cdot \sum_{k_3\in I_3}10^{k_3} \\ +& 8 \cdot \sum_{k_4\in I_4}10^{k_4} \\ +& 10 \cdot \sum_{k_5\in I_5}10^{k_5}\quad \left(= 1\cdot \sum_{k_5\in I_5}10^{k_5+1}\right) \\ +& 12 \cdot \sum_{k_6\in I_6}10^{k_6}\quad \left(= 2\cdot\sum_{k_6\in I_6}10^{k_6}+ 1\cdot \sum_{k_6\in I_6}10^{k_6+1} \right) \\ +& 14 \cdot \sum_{k_7\in I_7}10^{k_7}\quad \left(= 4\cdot\sum_{k_7\in I_7}10^{k_7}+ 1\cdot \sum_{k_7\in I_7}10^{k_7+1} \right) \\ +& 16 \cdot \sum_{k_8\in I_8}10^{k_8}\quad \left( = 6\cdot\sum_{k_8\in I_8}10^{k_8}+ 1\cdot \sum_{k_8\in I_8}10^{k_8+1}\right) \\ +& 18 \cdot \sum_{k_9\in I_9}10^{k_9}\quad \left(= 8\cdot\sum_{k_9\in I_9}10^{k_9}+1\cdot \sum_{k_9\in I_9}10^{k_9+1}\right) \end{align} This implies $$1\cdot (m_5+m_6+m_7+m_8+m_9)+2\cdot ( m_1+m_6)+4\cdot ( m_2+m_7)+6\cdot (m_3+m_8)+8\cdot (m_4+m_9)=110$$ So the solutions of the problem are solutions of the linear system \begin{align} 2\cdot m_1+4\cdot m_2+6\cdot m_3+8\cdot m_4+1\cdot m_5+3\cdot m_6+5\cdot m_7+7 \cdot m_8+9\cdot m_9=&110 \\ 1\cdot m_1+2\cdot m_2+3\cdot m_3+4\cdot m_4+5\cdot m_5+6\cdot m_6+7\cdot m_7+8\cdot m_8+9\cdot m_9=&100 \\ 1\cdot m_0+1\cdot m_1+1\cdot m_2+1\cdot m_3+1\cdot m_4+1\cdot m_5+1\cdot m_6+1\cdot m_7+1\cdot m_8+1\cdot m_9=&n \end{align}

Considering a number expressed by four decimal digits $$n=ABCD_d$$ let $$\sigma(n) = A+B+C+D$$ the sums of its decimal digits.

Doubling the number is equivalent to summing it to itself: $$2n = ABCD_d + ABCD_d$$ so the result will be composed summing each digit and, if the result is more than 10, the second digit is the carry that will increment the next more significant digit.

Regarding the sum of digits of the double, though, we can find a way to neglect the carry.

Consider for instance $$7621$$ and $$\sigma(7621) = 16$$. Doubling it we have $$15242$$ and $$\sigma(15242) = 14$$. But we may compute the same sum doubling each digit and getting the sum of each result. So from 7621 we double $$7 \rightarrow 14 \rightarrow 5$$, $$6 \rightarrow 12 \rightarrow 3$$ , $$2 \rightarrow 4$$ and $$1 \rightarrow 2$$ and $$5 +3 +4 + 2 = 14$$.

In the general case, to determine the sum of the digits of the double of a number, we transform each digit using the following table and sum the resulting digits.

$$\begin{array}{|r|r|r|} \hline x_i & 2x_i & y_i \\ \hline 0 & 0 & 0 \\ \hline 1 & 2 & 2 \\ \hline 2 & 4 & 4 \\ \hline 3 & 6 & 6 \\ \hline 4 & 8 & 8 \\ \hline 5 & 10 & 1 \\ \hline 6 & 12 & 3 \\ \hline 7 & 14 & 5 \\ \hline 8 & 16 & 7 \\ \hline 9 & 18 & 9 \\ \hline \end{array}$$

Consider now the original problem: given $$n$$ we define $$\sigma(n) = \sum_1^n x_i$$ where $$x_i$$ is the i-th digit. If we take $$y_i$$ as the image of $$x_i$$ with the former table we can state that $$\sigma(2n) = \sum_1^n y_i$$.

With these definitions, the problem becomes the solution of the following system $$\begin{cases} \sigma(n) = \sum_1^n x_i = 100 \\ \sigma(2n) = \sum_1^n y_i = 110 \end{cases}$$

where both $$x_i$$ and $$y_i \in \{0,1,2,3,4,5,6,7,8,9 \}$$

Let us now subtract the second equation from the first: we get $$\sigma(2n)-\sigma(n) = \sum_1^n y_i - \sum_1^n x_i = \sum_1^n (y_i - x_i) = 10$$

From the former table we can now derive the following

$$\begin{array}{|r|r|r|} \hline y_i & x_i & y_i - x_i \\ \hline 0 & 0 & 0 \\ \hline 2 & 1 & 1 \\ \hline 4 & 2 & 2 \\ \hline 6 & 3 & 3 \\ \hline 8 & 4 & 4 \\ \hline 1 & 5 & -4 \\ \hline 3 & 6 & -3 \\ \hline 5 & 7 & -2 \\ \hline 7 & 8 & -1 \\ \hline 9 & 9 & 0 \\ \hline \end{array}$$

With this result, we can immediately find a number $$n$$ so that $$\sigma(2n)-\sigma(n) = 10$$ by finding for instance 4 digits so that the sum of the corresponding numbers in the fourth column is 10. Consider $$n = 43228$$: transforming each digit of the second column into the corresponding digit of the third column we get $$\sigma(2n) = 4+3+2+2+(-1) = 10$$ and in fact $$\sigma(2n) = \sigma(86456) = 29$$ and $$\sigma(n) = 19 \Rightarrow \sigma(2n) - \sigma(n) = 10$$.

Considering the second table, it seems evident that $$9$$ and $$0$$ are equivalent with respect to the difference because they have 0 in the last column. So if in the previous number we insert one digit 9 and one digit 0 in any place, the difference between the sums of the digit of $$2n$$ and $$n$$ remains 10.

For instance $$n' = 4932028, 2n' = 9864056$$ and $$\sigma(2n') - \sigma(2n) = 38-28-10$$

Let us go back to the given problem. We must solve the following system of equations

$$\begin{cases} \sigma(n) = \sum_1^n x_i = 100 \\ \sigma(2n) -\sigma(n)= \sum_1^n y_i-x_i = 10 \end{cases}$$

Here are some interesting points

• The sum of digits does not depend on the order of the digits
• The sum of digits does not depend on the presence of one or more zeroes in the decimal representation of $$n$$
• $$\sigma(2n)-\sigma(n)$$ does not depend on the presence of $$0$$ or $$9$$ in the decimal representation of $$n$$

Let us now determine the smallest $$m | \sigma(2m)-\sigma(m) = 10$$

$$m$$ cannot have two digits as the maximum is $$4$$ and $$4+4=8<10$$ so we must use at least 3 digits. We have two options $$n=433$$ or $$m=442$$ and in fact $$\sigma(2n)-\sigma(n) = \sigma(866)-\sigma(433) = 10$$ and $$\sigma(2m)-\sigma(m) = \sigma(884)-\sigma(442) = 10$$

Given these numbers, we have $$\sigma(n) = 10$$ so in we must determine a number $$p$$ so that $$\sigma(p) = 90$$. We may choose $$p=9,999,999,999$$ as $$\sigma(p) = 9 \times 10 = 90$$

So here are two numbers having the required property $$p_1 = 2,449,999,999,999$$ and $$p_2 = 3,349,999,999,999$$.

Doubling yields

$$2 p_1 = 4,899,999,999,998$$ and $$2 p_2 = 6,699,999,999,998$$

Finally $$\sigma(2 p_1) = 110, \sigma(p_1) = 100$$ and $$\sigma(2 p_2) = 110, \sigma(p_2) = 100$$

These are the smallest numbers featuring this property. Of course any number composed by any possible permutation of these digits still has the required property.

Treating the problem this way suggests an algorithm to generate arbitrarily numbers having this or similar properties.