# Sum of digits of $11\dots 11^2$ where $11\dots 11$ is a 1992 digit number with all digits $1$ [duplicate]

I read this on a non-math forum where the OP says this is a question for Grade 6 elementary school students. Grade 6 elementary school level is somehow ambiguous but clearly this means no advanced math tool can be used. (Maybe some elementary modulo arithmetic is allowed?)

I tried in the most dumb way:

Since we know that $11\dots 1^2$ of $n\leq 9$ digits of $1$'s is $123\dots n \dots 321$ because $11\dots 1^2 = 11\dots 1 \times \sum^{n-1}_{m=0}10^m$ (which explains why the answer is $1$ goes to $n$ then goes back to $1$). So we can say $11\dots 11^2$ is to add up (digit number) of $1$, put it on that digit, and sum them up. Then we apply on $n>9$ and observe the process.

This seems promising or at least manageable. You count the number of $1$'s that are involved in computing number on the digit, and add carries from lower digits. For example, on the 102nd digits this will be $102+11+1=114$, so the carry is $11$, number of 102nd digit is $4$. Finally sum all digits up.

The work involved seems way too immense and is not beautiful. Anyone has some clever ideas about this question?

(The result is $17910$ and the original post is in Chinese, so I don't want to put the link here)

## marked as duplicate by Jyrki LahtonenApr 17 '15 at 9:27

Sum $=9n+((n \bmod 9)-9) (n \bmod 9)$ where $n=$ number of digits.

Check:

n = 1992;
9 n + (Mod[n, 9] -9) Mod[n, 9]
Total@IntegerDigits[FromDigits[ConstantArray[1, n]]^2]

• Is there any explanation of this algorithm? – MonkeyKing Apr 17 '15 at 1:15
• That's very clever martin. He used the fact that the average digit value will be 4.5, with the exception of the 'middle bit' which can be determined by taking $N \mod 9$ – Archaick Apr 17 '15 at 1:25
• What is the proof that the average digit value will be $4.5$? It certainly doesn't happen for small values of $n$; what property of $n$ implies this, and why? – Greg Martin Apr 17 '15 at 2:08
• See my answer. For every 9 digits which sum to 44 there are 9 which sum to 37. – Archaick Apr 17 '15 at 2:47

I think my method is essentially equivalent to Archaick's, but it might make it more clear how you can count without it being brute force per se. Note that the number we are squaring is $\frac{10^{1992}-1}{9}$, so we are counting the digits of $$\left(\frac{10^{1992}-1}{9}\right)^2 = \frac{1}{81}(10^{3984} - 2\cdot 10^{1992} +1)$$ To write this out as an integer, note that $$\frac{1}{81} = \frac{12,345,679}{999,999,999} \quad \text{ and thus} \quad \frac{2}{81} = \frac{24,691,358}{999,999,999}$$ This tells us the repeating 9-digit patterns in $\frac{10^{3984} }{81}$ and $\frac{2\cdot 10^{1992}}{81}$. To take the difference, note that the two leading terms are $1$'s in the $10^{3982}$ place and in the $10^{1990}$ place, respectively. The first subtraction then occurs at the latter digit, which corresponds to the digit $4$ in the expansion of $\frac{10^{3984} }{81}$, as $3982-3 = 3980 \equiv 1990 \mod 9$. The difference therefore has the repeating pattern unchanged from digits in the $10^{1991}$ place to the $10^{3982}$ place, and for lesser digits, the repeating pattern is now $$456,790,123-246,913,580 = 209,876,543$$ This pattern repeats indefinitely, until the decimal point, at which point we add $1/81$ with the effect of rounding $...320.\overline{976543210}$ up to $...321$.

Note that there are $221$ nine-digit sequences in each pattern, in addition to the leading three digits and the trailing two digits. The sum of the digits is then $1+2+3+221(44) + 221(37) + 2 + 1 = 9 + 221\cdot 81 = 17910$.

• ah, beat me to it as I was typing it out. This is the correct answer – qwr Apr 17 '15 at 1:30

This is not particularly pretty but I figured I'd share the complications which arise in using this method. If you multiply this out the way that most elementary students are taught to multiply numbers (at least in the US), you'll have a sum of the form $(11\ldots11)\sum_{i=1}^{1992}10^i$, lined up into $1991*2+1=3983$ columns. In the first column, there will be a single 1. In the second, there will be two, etc. Therefore the first nine digits will be $\ldots987654321$. The tenth digit will be a 0 and will be followed by a 2, instead of 1, owing to the 'carried' digit from when we reached the column which had 10 ones in it. More succinctly, the half of this expansion where the number of 1s in each column is increasing, will contribute $(11\ldots11)^2=\sum_{i=1}^{N} i(10)^{i-1}$ (where $N$ is the number of digits of the square) to the entire product. This pattern will continue until we get halfway through the total number of digits of the product. That is to say that every nine digits will cycle through $\ldots098765432\ldots$ It will only be nine because we 'skip' the ones, owing to the carried digits. Once we are precisely half way through the columns, the number of ones in each column will begin decreasing with every additional column. However, when we reach a column with $10^n+1$ 1s in it, there will no longer be any reason to skip it. However, when we get to a column which contains $10^n$ 1s in it, we will add $n$ to the next column, but only $n-1$ to the column after that. Hence, we will be skipping $8$s now. That is, after the halfway mark, we will see $12320$ (since $1992 \mod 9=3$) and then the digits will cycle through $\ldots123456790\ldots$. We are now ready to compute our grand total. The first 9 digits will contribute $1+2+3+4+5+6+7+8+9=45$. Since $1989/9= 221$, we will then have 220 cycles of $098765432$, each of which will contribute 44. We will also have $\ldots12320\ldots$ in the center which will contribute $8$ and then 221 cycles of$\ldots123456790\ldots$, each of which will contribute 37. $45+(220*44)+8+(221*37)=17910$. I have a hard time believing that there are more than a handful of sixth graders in the world capable of this sort of math.

• As shown by the original OP, it is just an example question in a math book, and he claimed that this is an elementary level question. So I suppose maybe it's a contest question. I think this method involves too much brute force and is not like to be an example question, so I asked here. – MonkeyKing Apr 17 '15 at 0:46
• Yes, I'd be very interested to see if someone came up with a non-brute force method. – Archaick Apr 17 '15 at 0:48
• However thank you a lot for actually presenting the whole computation out. I gave up on 100+ after realizing this doable but immense. – MonkeyKing Apr 17 '15 at 0:53
• No problem, thank you for giving me an interesting problem to work out :) – Archaick Apr 17 '15 at 1:00
• Elementary doesn't always mean "elementary school level". – DanielV Apr 17 '15 at 1:10