# What will be the 2014th digit?

Let $$a$$ be an integer $$\underbrace{33\ldots 33}_{2013}$$ and let $$b$$ be the integer $$\underbrace{66\ldots66}_{2013}$$

What is the 2014th digit (from the right) that appears in the product $$ab$$?

I tried using mod, but is it the correct way to approach this problem?

• $= 18\cdot 111\ldots111^2$. Obviously the digit you are asking for is in the middle of a mass of high-value binomial coefficients. I don't immediate see an easy way of extracting this with something much simpler than a full calculation. Jan 16, 2017 at 17:49
• What does "but is it true" mean here? What is it that you're asking about exactly? Jan 16, 2017 at 17:49
• @Omnomnomnom is it correct way of answering the ques? Jan 16, 2017 at 17:54
• See here for possibly useful formulas about the digits of the square of a repunit. The formula in the fourth bullet of my answer may prove to be useful. Jan 16, 2017 at 18:13
• @JyrkiLahtonen what is a repunit? Jan 17, 2017 at 2:24

\begin{align} ab&=18\cdot[\frac{10^{2013}-1}{9}]^2=\frac29[10^{4026}-2\cdot10^{2013}+1]\\ &=\frac29[(10^{4026}-1)-2(10^{2013}-1)]\\ &=2\cdot\frac{10^{4026}-1}9-4\cdot\frac{10^{2013}-1}9\\ &=\underbrace{22\ldots 2}_{4026}-\underbrace{44\ldots 4}_{2013}\\ &=\underbrace{22\ldots 2}_{2013}\underbrace{00\ldots 0}_{2013}-\underbrace{22\ldots 2}_{2013}\\ &=\underbrace{22\ldots 2}_{2012}1\underbrace{77\ldots 7}_{2012}8 \\ \end{align}

• Can u explain me the 2nd step? That 2/9[10^4916 -2.10^2013+1]? I know it's a dumb thing to ask but I don't want to proceed without understanding things. Please help me. Jan 17, 2017 at 2:26
• Just factor out $18\over{9^2}$ and expand the whole square Jan 17, 2017 at 2:34
• I guess u have to replace 4016 with 4026 everywhere right? Jan 17, 2017 at 5:41
• Yes, sorry for that. I typed this answer at midnight. Jan 17, 2017 at 5:42
• And 2 is the answer right? Coz Henning Makholm has given the answer as 1 Jan 17, 2017 at 5:43

Your number $ab$ is $18\cdot \underbrace{11\ldots 11}_{2013}{}^2$.

Let's imagine multiplying out the square of the repdigit with the usual pencil-and-paper algorithm. Before we start handling carries between the columns, the 2014th column will sum to $2012$, the one just to the right of it sums to $2013$, the one to the right of that sums to $2012$, then $2011$ and so forth (and what happens to the left is immaterial):

(To see this pattern, consider why $111{,}111{,}111\cdot 111{,}111{,}111= 12{,}345{,}678{,}987{,}654{,}321$, right before the columns start carrying into each other. The analogue of "2014th digit" here the 10th digit, which is the leftmost of the two 8s).

 2 0 1  2
+  2 0  1  3
+    2  0  1 2
+       2  0 1 1
+          2 0 1 0
+            .......
---------------------
=       ?


For simplicity, lets pre-multiply each of the rows here by $18$; then we will be adding

 3 6 2 1  6
+  3 6 2  3  4
+    3 6  2  1 6
+      3  6  1 9 8
+         3  6 1 8 0
+            3 6 1 6 2
+              .........
------------------------
?


In this addition there are only 5 nonzero digits in each column, so each carry is at most 4. The digits in the 2013th column sum to $4+1+1+6+3=15$, so depending on what the incoming carry is, the 2013th digit of the result is one of 5,6,7,8,9, and the carry into the 2014th column is necessarily $1$.

Therefore, summing the 2014th column, including the carry, we get $$(6+3+2+6+3)+1 = 20+1 = 21$$ so the final digit in the 2014th column is 1.