We are given a positive integer n such that n=s(n)2+2s(n)−2, where s(n) denotes the sum of the digits of n. We need to find the largest positive integer n that satisfies this equation.
1. Define the equation and constraints:
n=S2+2S−2
where S=s(n) is the sum of the digits of n.
2. **Determine the number of digits k in n:**
Since n has k digits, we have:
10k−1≤n<10k
Also, the sum of the digits S satisfies:
S≤9k
3. **Substitute n in the inequality:**
10k−1≤S2+2S−2
and
S≤9k
4. **Estimate the upper bound for k:**
10k−1<(9k+1)2
We need to find the largest k such that this inequality holds. Testing values of k:
- For k=3:
102=100<(9⋅3+1)2=282=784
This holds true.
- For k=4:
103=1000<(9⋅4+1)2=372=1369
This also holds true, but we need to check if k=4 provides a valid solution.
5. Check the divisibility condition:
Since n≡s(n)(mod9), we have:
n−S≡0(mod9)
Substituting n=S2+2S−2:
S2+2S−2−S≡0(mod9)
S2+S−2≡0(mod9)
Solving S2+S−2≡0(mod9):
S(S+1)≡2(mod9)
Testing values of S modulo 9, we find:
S≡1,7(mod9)
6. Combine constraints:
Since 10≤S≤27 and S≡1,7(mod9), possible values for S are:
S∈{10,16,19,25}
7. **Calculate n for each S:**
n=S2+2S−2
- For S=10:
n=102+2⋅10−2=100+20−2=118
- For S=16:
n=162+2⋅16−2=256+32−2=286
- For S=19:
n=192+2⋅19−2=361+38−2=397
- For S=25:
n=252+2⋅25−2=625+50−2=673
8. Verify the sum of digits:
- For n=118, s(118)=1+1+8=10
- For n=286, s(286)=2+8+6=16
- For n=397, s(397)=3+9+7=19
- For n=673, s(673)=6+7+3=16 (does not match)
Therefore, the valid solutions are n=118,286,397.
Conclusion:
The largest natural number n which satisfies the equation is n=397.
The final answer is 397