A machine allows you to type in any positive integer. It then multiplies the input by 2017 and displays the digit sum of the result on a screen. For example, typing in 1 gives 2+0+1+7=10.

What numbers can appear on the screen?

  • 6
    $\begingroup$ Just to clarify: Does the input '1' output '10' or '1'? (2017*1 = 2017 ==> 2+1+7 = 10) or ( another step of 1+0 = 1)? $\endgroup$ – stackErr Apr 11 '16 at 1:16
  • $\begingroup$ As worded, I see no reason to interpret it as the second case other than it would make the easy. $\endgroup$ – Fimpellizieri Apr 11 '16 at 1:49
  • 5
    $\begingroup$ It's only April :( $\endgroup$ – djechlin Apr 11 '16 at 3:47
  • $\begingroup$ What about doing -1 * 2017? $\endgroup$ – You Apr 11 '16 at 11:09

If the sum doesn't iterate, then you can obtain

Every positive integer greater than 1.


Note that the machine can produce the digit sum of any multiple of 2017. Given that:

$10^{1008} + 1$ is a multiple of 2017 with digit sum 2, and
$2 \cdot 10^{1008} + 10^{66}$ is a multiple of 2017 with digit sum 3,

We can produce a multiple of 2017 with digit sum equal to any positive integer larger than 1 by concatenating these two numbers an appropriate number of times. A digit sum of 1 is clearly impossible, as $10^x$ is not a multiple of 2017 for any $x$.

  • $\begingroup$ Wolfram Alpha's telling me that $10^{1008} + 2*10^{66}$ has remainder three, so the math is slightly off. But I like the overall idea. $\endgroup$ – Dennis Meng Apr 11 '16 at 2:12
  • $\begingroup$ The digit sum of $2017(10^{1008}+1)$ is 20 and the digit sum of $2017(10^{1008}+2\times 10^{66})$ is 21 $\endgroup$ – Jonathan Allan Apr 11 '16 at 2:13
  • $\begingroup$ @DennisMeng I swapped the multipliers, sorry. $\endgroup$ – ffao Apr 11 '16 at 2:13
  • 4
    $\begingroup$ @JonathanAllan He's saying that $10^{1008} + 1$ is the product, not the number you multiply by 2017. $\endgroup$ – Dennis Meng Apr 11 '16 at 2:14
  • $\begingroup$ @DennisMeng - ah, right. Yep checks out ^vote $\endgroup$ – Jonathan Allan Apr 11 '16 at 2:15

(All variables in this answer are assumed to be positive integers.)

$10$ is a primitive root $\mod2017$. This means that for any $n<2017$, there is an $m$ such that $10^m\equiv n\pmod{2017}$. Also note that $10^{2016}\equiv1\pmod{2017}$, so $10^{m+2016q}\equiv10^m\equiv n\pmod{2017}$.

Now, for any $x$, consider the integer $a_x=\frac{10^x-1}{9}$, which consists of $x$ 1s in a row. This is either a multiple of $2017$, or it is not (it is iff $x$ is a multiple of $2016$, but this isn't important). If it is not, let $b_x=a_x$. If it is divisible, let $b_x=a_x+9$. Either way, $b_x$ is $x$ digits long, has a digit sum of $x$, and is not divisible by $2017$. It leaves a remainder $r$ when divided by $2017$.

We know that there is a $m$ such that $10^m\equiv2017-r\pmod{2017}$, and we can choose a $q$ such that $m+2016q>x$. Then $10^{m+2016q}+b_x$, consisting of a 1 followed by some zeroes and then $b_x$, has a digit sum of $x+1$ and is a multiple of $2017$. Therefore all numbers greater than $1$ can be the digit sum of a multiple of $2017$.

$1$ obviously can't be the digit sum because only powers of $10$ have a digit sum of $1$, and none of them can be divisible by $2017$. So the answer is that any positive integer except $1$ can appear on the screen.


My guess is

Any positive integer(including zero) except 1, 2, 3 and 4

but I am sure that

1 can't be displayed regardless of input.

EDIT Sorry for not mentioning my reasoning about it.

I am sure that 1 can't be displayed regardless of input because of the following simple reason:
*The smallest positive number that you can input is 0 (which will display 0)
*To be able to display 1, you need to display at least one 1 and it should be in the last digit (if not, it is automatically greater than one [zero in last digit doesn't count]).
*It is possible to produce 1 in last digit because 2017 ends in 7. Any integer that ends in 3 will produce 1 in last digit when multiplied to it.
* The smallest of such number is 3 which result has a leading digits before 1 (so it is greater than 1). And since it is the smallest number, all number greater than it also results with leading number. It doesn't matter if 10000001 or 10000....0001 is divisible by 2017, it is greater than 1. Also, negative numbers didn't count because we are summing the digits.

  • $\begingroup$ Welcome, someone. It's generally good practice, here, to suffix an answer with reasoning as to why you think that an answer is correct, so that the person asking the question has something useful to respond to you with, other than "Yes" or "No." $\endgroup$ – Khale_Kitha Apr 11 '16 at 2:57
  • $\begingroup$ Suggestion: start with saying that the digit sum of $10n \cdot 2017$ is the same as that for $n \cdot 2017$, so we can consider just those $n$ not divisible by $10$. $\endgroup$ – Lawrence Apr 11 '16 at 10:41


The number displayed will be the digit sum of the positive integer.

For e.g.


Is equivalent to:
2+2=4 and 4+4+3+7+4=22 =4

  • $\begingroup$ Can anyone edit my answer to make it spoiler. For any reason it does not let me do that $\endgroup$ – LearningPhase Apr 11 '16 at 1:31
  • $\begingroup$ Examples don't really prove anything (as your previous answer should have told you) $\endgroup$ – ffao Apr 11 '16 at 1:32
  • $\begingroup$ 2017 is 1 mod 9, so the repeated digit sum will always be the same as the original's. This is why I don't think the question is asking for the sum to be repeated. $\endgroup$ – f'' Apr 11 '16 at 1:40
  • 2
    $\begingroup$ @LearningPhase If that's the case, you're going to have to explicitly state that you're assuming that the machine will iterate with the digit sums until it gets a number less than 10. Your answer as is doesn't make that assumption clear. $\endgroup$ – Dennis Meng Apr 11 '16 at 1:47
  • 1
    $\begingroup$ Though to be fair, you did give an example that iterated. $\endgroup$ – Dennis Meng Apr 11 '16 at 1:49

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.