I attempted to solve the following problem:

Let $S_1$ be the sum of the digits of $2012^{2012}$ and $S_2$ be the sum of the digits of $S_1$. Find $S_1$ and $S_2$.

Here is what I've got:

Let $n = 2012^{2012}$. Let $k_1$ be the number of digits of $n$. Let $k_2$ be the number of digits of $S_1$.

Finding the number of digits can be done by taking the "ceiling" term (or "floor" term and add $1$) of $\log_{10}n$, this gives:

$k_1=\left \lceil \log_{10}n \right \rceil = 6647$ and $k_2=\left \lceil \log_{10}S_1 \right \rceil$.

The idea I tried to use in order to calculate the sum of the digits is taking the sum of each $i$-th digit times the according power of $10$, for example for $2012$:

$2012= 2 \cdot 10^3+0 \cdot 10^2 + 1 \cdot 10^1 + 2 \cdot 10^0$.

For $S_1$ and $S_2$ this gives:

$S_1=\displaystyle\sum_{i=0}^{k_1-1} \lambda_i \cdot 10^i$ and $S_2=\displaystyle\sum_{i=0}^{k_2-1} \alpha_i \cdot 10^i$.

Then I tried to find a way to express the $\lambda_i$s and $\alpha_i$s, this is what i came up with:

$\lambda_i =\left \lfloor n \cdot 10^{-i} \mod 10 \right \rfloor ,\; i=0,\cdots,k-1$

$\alpha_i =\left \lfloor S_1 \cdot 10^{-i} \mod 10 \right \rfloor ,\; i=0,\cdots,k-1$.

Plugging it back in $S_1$ and $S_2$ gives:

$S_1=\displaystyle\sum_{i=0}^{k_1-1} \left \lfloor n\cdot10^{-i} \mod 10 \right \rfloor \cdot 10^i$

$S_2=\displaystyle\sum_{j=0}^{k_2-1}\sum_{i=0}^{k_1-1}\left( \left\lfloor \left\lfloor n\cdot 10^{-i} \mod 10 \right\rfloor \cdot 10^{i}\cdot 10^{-j} \mod 10 \right\rfloor \cdot 10^j \right) $.

Thank you very much for reading this far, now I have a some questions!

Firstly is this even correct? And if it is, is there a smarter way to calculate $S_1$ and $S_2$ (because with this formulation it clearly isn't possible to calculate by hand, unless you have a lot (a lot) of time to spare) or calculating it will always require a computer?

Apologies for any maths, synthax or english errors!

  • $\begingroup$ In base 2012, both $S_1$ and $S_2$ are $1$. $\endgroup$ – B. Goddard Jul 18 at 20:56
  • 1
    $\begingroup$ Simple arithmetic tells you that $S_2\in \{7,16,25,34\}$ but I don't see how to narrow that down without heavy labor, and the corresponding range for $S_1$ is not small. $\endgroup$ – lulu Jul 18 at 21:13
  • 1
    $\begingroup$ @lhf Log's tell us that $n$ has $6647$ digits, so we know that $S_1 \leq 9*6647=59832$ which has 5 digits. So we know that $S_2 \leq 9*5 =45$. We also know that $n\equiv 7 \pmod{9}$, so lulu's list is the numbers congruent to $7 \mod{9}$ and less than 45. (But I don't know why 43 isn't in her list.) $\endgroup$ – B. Goddard Jul 18 at 21:57
  • 1
    $\begingroup$ @lhf Since there are $6647$ digits in $N$, we see that $S_1≤9\times 6647=59823$. Thus $S_1$ has at most $5$ digits, and the first can not exceed $5$. Thus $S_2≤5+4\times 9=41$. As $S_1\equiv 7 \pmod 9$, we are done. $\endgroup$ – lulu Jul 18 at 22:58
  • 1
    $\begingroup$ @B.Goddard Since we know the first digit of $S_1$ is $≤5$ we must have $S_2≤5+4\times 9=41$. You can tighten that up a bit, but not enough to eliminate $34$ as an option, at least not that I can see. $\endgroup$ – lulu Jul 18 at 23:05

I don't think there is a hand accessible way to calculate these. Alpha gives $S_1=29383$ and from this it is easy to see $S_2=25$. You have correctly noticed that the sum of digits operator works a lot like a logarithm, so it makes big numbers much smaller. Usually when questions like this are asked there are enough sums taken (three in this case) that you can show the result has a single digit. Then you use the fact that the remainder on division by $9$ is maintained by the sum of digits, so if you can find the value $\bmod 9$ you are done. For this you would say $$2012^{2012}\equiv 5^{2012} \pmod 9\\ 5^6 \equiv 1 \pmod 9\\ 5^{2012}=5^{6\cdot 305+2}\equiv 5^2\equiv 7 \pmod 9$$ which is well within hand calculation.

  • $\begingroup$ For $S_2$ given $S_3$ there are limited possibilities. I can see how they might be constrained, but not quite how to hit the exact value. I was surprised to be asked for $S_1$, because that is well beyond the range of obvious constraints, unless there is some really neat trick for this particular value. $\endgroup$ – Mark Bennet Jul 18 at 22:02
  • $\begingroup$ @MarkBennet: We could guess an approximate value for $S_1$ by taking the average digit to be $4.5$. It is $4.42$ in fact. From that we can guess that $S_2$ is $16,25, 34$ or just possibly $43$. I don't see how to be sure which. Certainly $25$ is closest to $4.5$ per digit of $S_1$ $\endgroup$ – Ross Millikan Jul 18 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.