I recently came across a quite interesting short math question. The question goes:
The problem# Find the sum of the digits of N 2 N^2 N 2 , where
N = 888 ⋯ 8 ⏟ 2025 digits . N=\underbrace{888\cdots 8}_{2025\text{ digits}}. N = 2025 digits 888 ⋯ 8 . The solution# The nice part of this problem is that we can set it up nicely such that the number is split into two blocks whose digit sums complement each other.
First, we have
N = 8 9 ( 1 0 2025 − 1 ) . N=\frac{8}{9}(10^{2025}-1). N = 9 8 ( 1 0 2025 − 1 ) . Since 2025 = 9 ⋅ 225 2025=9\cdot225 2025 = 9 ⋅ 225 , the number 1 0 2025 − 1 10^{2025}-1 1 0 2025 − 1 is divisible by 1 0 9 − 1 = 999999999 10^9-1=999999999 1 0 9 − 1 = 999999999 , which is also divisible by 81 81 81 . Therefore, we may know that
φ = 64 81 ( 1 0 2025 − 1 ) \varphi=\frac{64}{81}(10^{2025}-1) φ = 81 64 ( 1 0 2025 − 1 ) is an integer. We also have 0 < φ < 1 0 2025 0<\varphi<10^{2025} 0 < φ < 1 0 2025 . Using this auxiliary number, we can rewrite the square as
N 2 = 64 81 ( 1 0 2025 − 1 ) 2 = φ ( 1 0 2025 − 1 ) = ( φ − 1 ) 1 0 2025 + ( 1 0 2025 − φ ) . \begin{aligned} N^2 &=\frac{64}{81}(10^{2025}-1)^2\\ &=\varphi(10^{2025}-1)\\ &=(\varphi-1)10^{2025}+(10^{2025}-\varphi). \end{aligned} N 2 = 81 64 ( 1 0 2025 − 1 ) 2 = φ ( 1 0 2025 − 1 ) = ( φ − 1 ) 1 0 2025 + ( 1 0 2025 − φ ) . Because 0 < 1 0 2025 − φ < 1 0 2025 0<10^{2025}-\varphi<10^{2025} 0 < 1 0 2025 − φ < 1 0 2025 , this expression places φ − 1 \varphi-1 φ − 1 in the left block and 1 0 2025 − φ 10^{2025}-\varphi 1 0 2025 − φ in the right block, padding the right block with leading zeros if needed. The blocks do not overlap, so their digit sums simply add.
Let S ( x ) S(x) S ( x ) denote the sum of the decimal digits of x x x . Then
S ( N 2 ) = S ( φ − 1 ) + S ( 1 0 2025 − φ ) . S(N^2)=S(\varphi-1)+S(10^{2025}-\varphi). S ( N 2 ) = S ( φ − 1 ) + S ( 1 0 2025 − φ ) . Furthermore, notice that
S ( φ − 1 ) = S ( φ ) − 1. S(\varphi-1)=S(\varphi)-1. S ( φ − 1 ) = S ( φ ) − 1. Hence
1 0 2025 − φ = ( 1 0 2025 − 1 ) − ( φ − 1 ) . 10^{2025}-\varphi=(10^{2025}-1)-(\varphi-1). 1 0 2025 − φ = ( 1 0 2025 − 1 ) − ( φ − 1 ) . Since the terms are set up so nicely, we now have
S ( 1 0 2025 − φ ) = 9 ⋅ 2025 − S ( φ − 1 ) = 9 ⋅ 2025 − S ( φ ) + 1. \begin{aligned} S(10^{2025}-\varphi) &=9\cdot2025-S(\varphi-1)\\ &=9\cdot2025-S(\varphi)+1. \end{aligned} S ( 1 0 2025 − φ ) = 9 ⋅ 2025 − S ( φ − 1 ) = 9 ⋅ 2025 − S ( φ ) + 1. Adding the two digit sums makes the unknown terms cancel:
S ( N 2 ) = ( S ( φ ) − 1 ) + ( 9 ⋅ 2025 − S ( φ ) + 1 ) = 9 ⋅ 2025 = 18225 . \begin{aligned} S(N^2) &=\bigl(S(\varphi)-1\bigr) +\bigl(9\cdot2025-S(\varphi)+1\bigr)\\ &=9\cdot2025\\ &=\boxed{18225}. \end{aligned} S ( N 2 ) = ( S ( φ ) − 1 ) + ( 9 ⋅ 2025 − S ( φ ) + 1 ) = 9 ⋅ 2025 = 18225 .