3

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?

CrSb0001
  • 2,820
  • 3
    Since you only care about the last four digits, you can work $\pmod {10^5}$. So your sum is basically a multiplication. – lulu May 05 '23 at 15:59
  • 3
    Typo: meant to write $\pmod {10^4}$ – lulu May 05 '23 at 16:04
  • @lulu Is my solution correct though? – CrSb0001 May 05 '23 at 16:21
  • 2
    No. In any case the method you propose is far too complicated and error prone. Either write it as a geometric series (more complicated method) or do what I said and write it as $(2+22+222+(1042-3)\times 2222) \equiv 8904 \pmod {10^4}$ (easiest method). – lulu May 05 '23 at 16:24
  • 1
    Just to confirm the result via geometric series, here. – lulu May 05 '23 at 16:26
  • You have asked many solution-verification questions recently. However, I don't see any answer that attempts to point out any general flaws that your workings contain : mistakes you seem to make regularly, patterns in errors you make, and so on. I don't know if you do this yourself and hope you do, but do look at your many questions here and see if there's something in your problem solving process itself that you need to address. Also, consider attempting questions that are of a "similar" theme (ask someone for assistance) : these are great in identifying issues with your writing. – Sarvesh Ravichandran Iyer May 06 '23 at 11:37

3 Answers3

4

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*}$$

user170231
  • 25,320
3

To answer your questions:

  1. In your approach, instead of 2042, you should be using 1042. That's the only error you made. With that, you get 8904 as shown below.
  2. A slightly simpler approach is to find $ 2 + 22 + 222 + (1042-3) \times 2222 \pmod{10000}$ like lulu mentioned.

Your approach is to find $2 + 22 + 222 + 2222 + 2222 + 2222 + \ldots + 2222 \pmod{10000}$.
You already made the observation that $ 9 \times 2222 \equiv -2 \pmod{10000}$.
So, what we want is $ 2 + 22 + 222 + \lfloor \frac{ 1042 - 3 } { 9} \rfloor \times ( - 2 ) + 9\times \{ \frac{1042-3}{9} \} \times 2222 \pmod{10000}$.
(I chose to use "-3" because that is the start of the pattern. We could take "-4" or "-13" as desired, and just ensure we account for the number of terms correctly.)
This is equal to $8904 \pmod{10000}$.

Calvin Lin
  • 77,541
1

The easiest way to see this, in my opinion, is just to look at the last four digits and compute the sum for those: $2+22+222+2222\cdot1039=2308904 $. This is feasible for this case, because the result is small. For a larger calculation, you can do what other users have commented. So, the solution is $8904$, as evidenced by the value below.

It is easy to right a program to calculate this sum. In Python, it looks like this:

s=0
for k in range(1,1043):
    n=0
    for j in range(0,k):
        n=2*10**j+n
    s=s+n
print(s)

The solution is: $$2469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802468904 $$

Yester
  • 414