Maths WorkshopMaths problems with full solutions
Exercise 618Number theory › CongruencesM1Added 4 Nov 2026

n + S(n) + S(S(n)) = 60

#digit sum#congruence modulo 9#bounding

Statement

Let S(n)S(n) denote the sum of the decimal digits of nn. Find all positive integers nn such that
n+S(n)+S(S(n))=60.n+S(n)+S(S(n))=60.

Hint

Use S(m)≡m(mod9)S(m)\equiv m\pmod9 to restrict nn modulo 33, then bound nn from below.

Show solutionHide solution

Solution

Idea. A congruence cuts the candidates by a factor of 33; a size estimate makes the list finite and short.

Congruence. S(n)≡nS(n)\equiv n and S(S(n))≡n(mod9)S(S(n))\equiv n\pmod9, so the left side is ≡3n(mod9)\equiv3n\pmod9. Since 60≡6(mod9)60\equiv6\pmod9, 3n≡6(mod9)3n\equiv6\pmod9, i.e. n≡2(mod3)n\equiv2\pmod3.

Bounds. Clearly n<60n<60, so S(n)≤S(49)=13S(n)\le S(49)=13 or S(59)=14S(59)=14: at most 1414. Then S(S(n))≤9S(S(n))\le9 (the maximum of SS over 1,…,141,\dots,14 is 99). Hence n≥60−14−9=37n\ge60-14-9=37.

Candidates. n∈[37,59]n\in[37,59] with n≡2(mod3)n\equiv2\pmod3: 38,41,44,47,50,53,56,5938,41,44,47,50,53,56,59.
- 3838: 38+11+2=5138+11+2=51
- 4141: 41+5+5=5141+5+5=51
- 4444: 44+8+8=6044+8+8=60 ✓
- 4747: 47+11+2=6047+11+2=60 ✓
- 5050: 50+5+5=6050+5+5=60 ✓
- 5353: 53+8+8=6953+8+8=69
- 5656: 56+11+2=6956+11+2=69
- 5959: 59+14+5=7859+14+5=78

Answer. n∈{44,47,50}n\in\{44,47,50\}.

Lesson. For digit-sum equations, combine the congruence S(n)≡n(mod9)S(n)\equiv n\pmod9 with a crude bound on S(n)S(n), then check the remaining few cases.