We have n = 1000a + 100b + 10c + d, where 0 <= b, c, d <= 9 and 1 <= a <= 9 (because n is a four-digit number), and a+b+c+d = 10c+d (the sum of all four digits is equal to the result of erasing the first two digits). From a+b+c+d = 10c+d, subtracting c+d from both sides, we get a+b = 9c. Since 1<=a<=9 and 0<=b<=9 we have 1<=a+b<=18, so the only possibilities for c are 1 (giving a+b=9) and 2 (giving a+b=18). In case c=1, where we have b=9-a, the largest possible n comes from choosing the largest possible a and d, namely a=d=9, and then b=9-a=0, so we get 9019. The smallest possible n comes from choosing the smallest possible a and d, namely a=1 and d=0, and then b=9-a=8, giving 1810. In case c=2, where we have a+b=19, both a and b must be 9. We only get to choose d, so the largest possible n in this case is 9929 and the smallest is 9920.

So overall, as others have already said, the largest possible n is 9927 (with 9+9+2+7 = 27) and the smallest is 1810 (with 1+8+1+0 = 10).

## Konstantin:

9927 and 1818

31 October 2022, 4:41 pm## eerk:

9929, 1810

31 October 2022, 6:54 pm## Loretta Kelley:

Very clever! Those values look right, but can you prove that they are the largest and smallest?

a + b + c + d – 10c + d leads to the necessary condition that a + b = 9c

This fits your numbers but I cannot go any further to eliminate smaller and larger four-digit numbers.

31 October 2022, 7:13 pm## Leo B.:

9929 and 1810

31 October 2022, 7:55 pm## Antoine:

Brute force is possible, using a small python program to browse through all numbers between 1000 and 9999.

1 November 2022, 2:29 pmI get the same answer as Leo.

## buster:

We have n = 1000a + 100b + 10c + d, where 0 <= b, c, d <= 9 and 1 <= a <= 9 (because n is a four-digit number), and a+b+c+d = 10c+d (the sum of all four digits is equal to the result of erasing the first two digits). From a+b+c+d = 10c+d, subtracting c+d from both sides, we get a+b = 9c. Since 1<=a<=9 and 0<=b<=9 we have 1<=a+b<=18, so the only possibilities for c are 1 (giving a+b=9) and 2 (giving a+b=18). In case c=1, where we have b=9-a, the largest possible n comes from choosing the largest possible a and d, namely a=d=9, and then b=9-a=0, so we get 9019. The smallest possible n comes from choosing the smallest possible a and d, namely a=1 and d=0, and then b=9-a=8, giving 1810. In case c=2, where we have a+b=19, both a and b must be 9. We only get to choose d, so the largest possible n in this case is 9929 and the smallest is 9920.

So overall, as others have already said, the largest possible n is 9927 (with 9+9+2+7 = 27) and the smallest is 1810 (with 1+8+1+0 = 10).

1 November 2022, 3:16 pm## buster:

Oops! *”where we have a+b=18″, not 19!

1 November 2022, 3:19 pm## buster:

Oops again: *”the largest possible n is 9929 (with 9+9+2+9 = 29)”.

(Moderator — would you care to fix those two mistakes in my original reply, to tidy things up?)

1 November 2022, 3:51 pm