Maths Olympiad Prep

Library / /102 of 520

Number theory Difficulty 6.5 National olympiad Find the answer

Given a positive integer n,n, let s(n)s(n) denote the sum of the digits of n.n. Compute the largest positive integer nn such that n=s(n)2+2s(n)2.n = s(n)^2 + 2s(n) - 2.

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

Solution

We are given a positive integer n n such that n=s(n)2+2s(n)2 n = s(n)^2 + 2s(n) - 2 , where s(n) s(n) denotes the sum of the digits of n n . We need to find the largest positive integer n n that satisfies this equation.

1. Define the equation and constraints:
n=S2+2S2 n = S^2 + 2S - 2
where S=s(n) S = s(n) is the sum of the digits of n n .

2. **Determine the number of digits k k in n n :**
Since n n has k k digits, we have:
10k1n<10k 10^{k-1} \leq n < 10^k
Also, the sum of the digits S S satisfies:
S9k S \leq 9k

3. **Substitute n n in the inequality:**
10k1S2+2S2 10^{k-1} \leq S^2 + 2S - 2
and
S9k S \leq 9k

4. **Estimate the upper bound for k k :**
10k1<(9k+1)2 10^{k-1} < (9k + 1)^2
We need to find the largest k k such that this inequality holds. Testing values of k k :

- For k=3 k = 3 :
102=100<(93+1)2=282=784 10^2 = 100 < (9 \cdot 3 + 1)^2 = 28^2 = 784
This holds true.

- For k=4 k = 4 :
103=1000<(94+1)2=372=1369 10^3 = 1000 < (9 \cdot 4 + 1)^2 = 37^2 = 1369
This also holds true, but we need to check if k=4 k = 4 provides a valid solution.

5. Check the divisibility condition:
Since ns(n)(mod9) n \equiv s(n) \pmod{9} , we have:
nS0(mod9) n - S \equiv 0 \pmod{9}
Substituting n=S2+2S2 n = S^2 + 2S - 2 :
S2+2S2S0(mod9) S^2 + 2S - 2 - S \equiv 0 \pmod{9}
S2+S20(mod9) S^2 + S - 2 \equiv 0 \pmod{9}
Solving S2+S20(mod9) S^2 + S - 2 \equiv 0 \pmod{9} :
S(S+1)2(mod9) S(S + 1) \equiv 2 \pmod{9}
Testing values of S S modulo 9, we find:
S1,7(mod9) S \equiv 1, 7 \pmod{9}

6. Combine constraints:
Since 10S27 10 \leq S \leq 27 and S1,7(mod9) S \equiv 1, 7 \pmod{9} , possible values for S S are:
S{10,16,19,25} S \in \{10, 16, 19, 25\}

7. **Calculate n n for each S S :**
n=S2+2S2 n = S^2 + 2S - 2
- For S=10 S = 10 :
n=102+2102=100+202=118 n = 10^2 + 2 \cdot 10 - 2 = 100 + 20 - 2 = 118
- For S=16 S = 16 :
n=162+2162=256+322=286 n = 16^2 + 2 \cdot 16 - 2 = 256 + 32 - 2 = 286
- For S=19 S = 19 :
n=192+2192=361+382=397 n = 19^2 + 2 \cdot 19 - 2 = 361 + 38 - 2 = 397
- For S=25 S = 25 :
n=252+2252=625+502=673 n = 25^2 + 2 \cdot 25 - 2 = 625 + 50 - 2 = 673

8. Verify the sum of digits:
- For n=118 n = 118 , s(118)=1+1+8=10 s(118) = 1 + 1 + 8 = 10
- For n=286 n = 286 , s(286)=2+8+6=16 s(286) = 2 + 8 + 6 = 16
- For n=397 n = 397 , s(397)=3+9+7=19 s(397) = 3 + 9 + 7 = 19
- For n=673 n = 673 , s(673)=6+7+3=16 s(673) = 6 + 7 + 3 = 16 (does not match)

Therefore, the valid solutions are n=118,286,397 n = 118, 286, 397 .

Conclusion:
The largest natural number n n which satisfies the equation is n=397 n = 397 .

The final answer is 397 \boxed{397}

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: NuminaMath-1.5, licensed Apache-2.0. Statement and solution reproduced as published; topic and difficulty added by this site.