How would one go about finding the last four digits of this sum

pattern recognitionsolution-verification

So I was looking through the homepage of Youtube when I found this video by Cipher. The question proposed in the video was$$\text{How do I find the last }4\text{ digits of the sum of }2+22+222+2222+\dots+\underbrace{222\dots222}_{1042\text{ digits}}\text{?}$$which I thought that I might be able to solve. Here is my attempt at solving the aforementioned question:$$\text{First step: Find a pattern in the first four digits}$$$$2$$$$24$$$$246$$$$2468$$$$4690$$$$6912$$$$9134$$$$1356$$$$3578$$$$5800$$$$8022$$$$0244$$$$2466$$As you can see:$$\text{Term }4\text{: }2468$$$$\text{Term }13\text{: }2466$$$$13-4=9\text{ terms between the first term that contains }4\text{ digits and the next term that follows a pattern}$$$$\text{Therefore every }9\text{ terms the last }4\text{ digits will be }2\text{ less than the last term in the pattern.}$$$$\text{Therefore we need to do}$$$$\left\lfloor\frac{2042-13}{9}\right\rfloor$$Which simplifies to$$225\text{ and a remainder of }4$$Which means we now need to go back $4$ terms in the sequence from term $13$ and then subtract $500$ from that, and we get$$3578-500=3078$$

Therefore, the last four digits of the sum of$$2+22+222+2222+\dots+\underbrace{222\dots222}_{1042\text{ digits}}$$Is 3078.$$\mathbf{\text{My question}}$$


Is the solution that I achieved correct, or what could I do to attain the correct solution/attain it more easily?

Best Answer

Adding up the digits with the same place value gives

$$\begin{array}{ccccccccc} & 2 & 2 & 2 & \cdots & 2 & 2 & 2 & 2 \\ & & 2 & 2 & \cdots & 2 & 2 & 2 & 2 \\ & & & 2 & \cdots & 2 & 2 & 2 & 2 \\ & & & & \ddots & \vdots & \vdots & \vdots & \vdots\\ & & & & & 2 & 2 & 2 & 2 \\ & & & & & & 2 & 2 & 2 \\ & & & & & & & 2 & 2 \\ + & & & & & & & & 2 \\ \hline & 2\times1 & 2\times2 & 2\times3 & \cdots & 2\times1039 & 2\times1040 & 2\times1041 & 2\times1042 \end{array}$$

i.e. a number in base $10$ whose $(10^{n-1})$s value is $2\times(1042-n)$ $(n\ge1)$. A proper number in base $10$ has digits that do not exceed $9$. To make this number proper, carry over the excess to the next place value. Looking at only the last four place values, we have

$$\begin{align*} \cdots[2078][2080][2082][2084] &= \cdots[2078][2080][2082][2084] \\ &= \cdots[2078][2080][2082+208]\color{red}{4} \\ &= \cdots[2078][2080][2290]4 \\ &= \cdots[2078][2080+229]\color{red}{0}4 \\ &= \cdots[2708][2309]04 \\ &= \cdots[2708+230]\color{red}{9}04 \\ &= \cdots[2938]904 \\ &= \cdots\boxed{\color{red}{8}904} \end{align*}$$

Related Question