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?