Maths Olympiad Prep

Library / /4 of 13

Number theory Difficulty 6.2 National olympiad Find the answer

For each positive integer nn, let s(n)s(n) be the sum of the squares of the digits of nn. For example, s(15)=12+52=26s(15)=1^2+5^2=26. Determine all integers n1n\geq 1 such that s(n)=ns(n)=n.

A number or a short expression. Spacing and $ signs are ignored.

Solution

Given the problem, we want to determine all integers n1 n \geq 1 such that the sum of the squares of the digits of n n , denoted as s(n) s(n) , is equal to n n .

To begin, let's express n n in terms of its digits. Suppose n n is a k k -digit number given by:
n=dk110k1+dk210k2++d1101+d0100 n = d_{k-1} \cdot 10^{k-1} + d_{k-2} \cdot 10^{k-2} + \cdots + d_1 \cdot 10^1 + d_0 \cdot 10^0
where di d_i represents the i i -th digit of n n and 0di9 0 \leq d_i \leq 9 for 0ik1 0 \leq i \leq k-1 , with dk10 d_{k-1} \neq 0 because dk1 d_{k-1} is the leading digit.

The function s(n) s(n) is defined as:
s(n)=dk12+dk22++d12+d02. s(n) = d_{k-1}^2 + d_{k-2}^2 + \cdots + d_1^2 + d_0^2.

Given s(n)=n s(n) = n , we want:
dk12+dk22++d12+d02=dk110k1+dk210k2++d1101+d0. d_{k-1}^2 + d_{k-2}^2 + \cdots + d_1^2 + d_0^2 = d_{k-1} \cdot 10^{k-1} + d_{k-2} \cdot 10^{k-2} + \cdots + d_1 \cdot 10^1 + d_0.

For k=1 k = 1 , n=d0 n = d_0 , we reach a straightforward solution:
s(n)=d02=n=d0    d02=d0. s(n) = d_0^2 = n = d_0 \implies d_0^2 = d_0.
Thus, d0=0 d_0 = 0 or d0=1 d_0 = 1 . Since n1 n \geq 1 , we have d0=1 d_0 = 1 . This gives n=1 n = 1 .

For k2 k \geq 2 , we explore the possibility of higher k k . Notice that for a two-digit number n n with digits d1,d0 d_1, d_0 :
s(n)=d12+d02andn=10d1+d0. s(n) = d_1^2 + d_0^2 \quad \text{and} \quad n = 10d_1 + d_0.
Thus, d12+d02=10d1+d0 d_1^2 + d_0^2 = 10d_1 + d_0 .

To analyze further, consider the rough inequality result for the maximum digit value:
d12+d0281+81=162. d_1^2 + d_0^2 \leq 81 + 81 = 162.
This suggests n=10d1+d0162 n = 10d_1 + d_0 \leq 162 . However, testing feasible digit options within this limit shows no solutions beyond the trivial single-digit case n=1 n = 1 .

The analysis implies that the only integer n1 n \geq 1 satisfying s(n)=n s(n) = n is indeed:
1 \boxed{1}
This wraps up the exploration, confirming that 1 is, in fact, the unique solution.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: Omni-MATH, licensed Apache-2.0. Statement and solution reproduced as published; topic and difficulty added by this site.