# The first digit (on the left) and the last digit (on the right) of $\sum_{k=1}^{1010}k^{2020-k}$

The first digit (on the left) and the last digit (on the right) of $$\sum_{k=1}^{1010}k^{2020-k}=1^{2019}+2^{2018}+3^{2017}+\dots+1010^{1010}$$ are to be obtained not by using computers/calculators.

My Attempt for the last digit (the units digits):

$$\left.\begin{matrix} 1^{2019}\equiv 1 \text{ (mod 10)}\\ 2^{2018}\equiv 4 \text{ (mod 10)}\\ 3^{2017}\equiv 3 \text{ (mod 10)}\\ 4^{2016}\equiv 6 \text{ (mod 10)}\\ 5^{2015}\equiv 5 \text{ (mod 10)}\\ 6^{2014}\equiv 6 \text{ (mod 10)}\\ 7^{2013}\equiv 7 \text{ (mod 10)}\\ 8^{2012}\equiv 6 \text{ (mod 10)}\\ 9^{2011}\equiv 9 \text{ (mod 10)}\\ 10^{2010}\equiv 0 \text{ (mod 10)}\\ \end{matrix}\right\} \text{ this pattern repeats } \frac{1010}{10}=101 \text{ times for the next terms.}$$

The units digit of the sum of the first $$10$$ terms

$$=(1+4+3+6+5+6+7+6+9+0)$$ $$($$mod $$10)=47$$ $$($$mod $$10)=7$$

Therefore, the units digit of the given expression is $$(7 \times 101)$$ $$($$mod $$10)=707$$ $$($$mod $$10)=7$$.

I am not sure if I am right or wrong. Please let me know.

Also, I do not know anyway to find the first digit (on the left).

Any help would be appreciated. THANKS!

• I am sceptical that the first digit can be found out by hand. We would not only need logarithms, but also it would be difficult to find out the largest summand and whether it is large enough compared to the rest of the sum to determine the first digit. Sep 5, 2019 at 7:53
• Where id the question come from? You think about it or it shows in books or contests? Sep 5, 2019 at 8:56
• @IsaacYIUMathStudio I was reading a book in number theory, in a chapter about modular arithmetic. This question just pop-up in my mind. Sep 5, 2019 at 9:00

Your computation for the last digit looks correct.

I don't think one can compute the first digit without a computer. Here is my reasoning. Let us first try to find out which terms in the sum are biggest. If the biggest term is more than $$10$$ times as big as the sum of the rest, it is sufficient to compute the first digit of that term, otherwise we would need a few of the biggest terms.

Consider the function $$f(x)=x^{2020-x}$$ and compute where the maximum is. Differentiating and setting to zero gives the equation $$x\cdot(1 + \ln(x))=2020$$. We don't need the exact value but one can see without calculator that this is the unique maximum and that it is somewhere inside the range from $$1$$ to $$1010$$. Without calculator my guess would be somewhere around 300.

Now computing the first digit of one such term, say $$300^{1720}$$ is already quite tricky and long without calculator. Additionally we don't know how big the biggest term is compared to the rest of them.

• actually by x typically being the large half we can use a geometric mean to predict it must be greater than 45 gauranteed pretty easily.
– user645636
Sep 5, 2019 at 11:55

The last digit does not appear to be computed correctly, or lacking in steps, though it yields the correct answer. Note, for example, that $$12^{2008}\equiv2^{2008}\equiv6$$, which is not equal to $$2^{2018}\equiv4$$, which is what I gather you were implying. It is interesting to note, however, that the last digit of $$\sum_{n=1}^9(10k+n)^{2020-10k-n}$$ is always $$7$$, due to the period of $$n^{10k}$$ for each $$n$$ aligning so. And thus the last digit is still $$7$$.

As for the first digit, we take the log of each term and use a bit of calculus to find the maximum. This would give us the equation $$2020=x(1+\ln(x))$$.

Using fixed-point iteration starting with $$x=2020$$, we then need to calculate $$\ln(2020)$$. We know that roughly $$e^3\approx20$$ and thus $$e^{7.5}\approx20^{2.5}=400\sqrt{20}\approx2020$$. Compare this to the actual $$\ln(2020)\approx7.611$$ and you'll see this is a fairly decent approximation. Using our approximation, the next iteration gives $$x\approx2020/8.5\approx238$$.

Using $$e^{5.25}\approx20^{1.75}\approx238$$ we then get $$\ln(238)\approx5.25$$, and our next iteration gives $$x\approx2020/6.25\approx323$$.

Using $$18^2\approx323$$, we thus have $$\ln(323)\approx2\ln(18)=2\ln(20)-2\ln(10/9)\approx6-2\ln(1+1/9)$$ $$\approx6-2\left(\frac19-\frac1{2\cdot81}+\frac1{3\cdot729}\right)\approx6-2\cdot0.105\approx5.79$$. So our next iteration has $$x\approx2020/6.79\approx300$$.

Which is astoundingly close to the nearest integer to the root, which is $$301$$. At this point though, I would simply attempt to work out the values around $$300$$, and thus try to work out the first digit of:

$$\dots+299^{1721}+300^{1720}+301^{1719}+\dots$$

working them out until I felt sufficiently comfortable they were decaying sufficiently fast. By using a calculator, one can find that every term from $$n=291$$ to $$n=312$$ have 4260 digits. Depending on the second digit of the sum of the above numbers, more terms may be needed to be checked. Computation of the leading digits of each may be done by taking the fractional part of $$(2020-n)\ln(n)$$ and raising it to the power of 10.

:I which I suppose is one way you could spend your day.