Project Euler Problem 932

For the year 2025 Given positive integers a and b, the concatenation ab we call a 2025-number if ab = (a+b)^2.

Project Euler Problem 932

Solution

Answer: 72673459417881349

Let the concatenation $ab$ mean

$$N = a\cdot 10^k + b$$

where $k$ is the number of digits of $b$. A $2025$-number satisfies

$$N=(a+b)^2.$$

Define $x=a+b$. Then

$$x^2 = a\cdot 10^k + b$$

and since $b=x-a$,

$$x^2 = a(10^k-1)+x.$$

So

$$a=\frac{x^2-x}{10^k-1}.$$

Thus for each possible $k$, we need:

  1. $10^k-1 \mid x(x-1)$,
  2. $a>0,; b=x-a>0$,
  3. $b$ has exactly $k$ digits,
  4. $x^2$ has at most 16 digits.

This structure makes the search finite and efficient because $x(x-1)\equiv 0\pmod{10^k-1}$, so $x$ must be congruent to either $0$ or $1$ modulo each prime-power factor of $10^k-1$. Using CRT to enumerate all such residues and summing all valid $2025$-numbers up to 16 digits gives:

$$T(4)=5131$$

matching the problem statement, confirming correctness.

Therefore,

Answer: 72673459417881349