Skip to content

Problem 932: 2025

This content is not available in your language yet.

Problem 932: 2025

For the year 20252025

2025=(20+25)22025 = (20 + 25)^2

Given positive integers aa and bb, the concatenation abab we call a 20252025-number if ab=(a+b)2ab = (a+b)^2.
Other examples are 30253025 and 8181.
Note 98019801 is not a 20252025-number because the concatenation of 9898 and 11 is 981981.

Let T(n)T(n) be the sum of all 20252025-numbers with nn digits or less. You are given T(4)=5131T(4) = 5131.

Find T(16)T(16).

The problem asks for the sum of all “2025-numbers” up to 16 digits. A direct search is infeasible. We need to find a mathematical structure to generate these numbers efficiently.

Let a 2025-number NN be formed by concatenating a positive integer aa and a kk-digit positive integer bb. The definition gives us two equations:

  1. N=a10k+bN = a \cdot 10^k + b (from concatenation)
  2. N=(a+b)2N = (a+b)^2 (the 2025-property)

Let’s introduce a variable for the sum, s=a+bs = a+b. The number is then simply s2s^2. Substituting ss and a=sba=s-b into the first equation gives:

s2=(sb)10k+bs2=s10kb10k+bs2=s10kb(10k1)b(10k1)=s10ks2=s(10ks)\begin{align*} s^2 &= (s-b) \cdot 10^k + b \\ s^2 &= s \cdot 10^k - b \cdot 10^k + b \\ s^2 &= s \cdot 10^k - b(10^k - 1) \\ b(10^k - 1) &= s \cdot 10^k - s^2 = s(10^k - s) \end{align*}

This gives us a formula for bb: b=s(10ks)10k1b = \frac{s(10^k - s)}{10^k - 1}

We can simplify this expression to find a formula for aa as well:

b=s(10k1(s1))10k1=ss(s1)10k1b = \frac{s(10^k - 1 - (s-1))}{10^k - 1} = s - \frac{s(s-1)}{10^k - 1}

Since a=sba = s-b, we arrive at a remarkably simple formula for aa: a=s(s1)10k1a = \frac{s(s-1)}{10^k - 1}

So, for any given number of digits kk for the “right part” bb, any 2025-number can be generated from a sum ss that satisfies our conditions.

The formula for aa reveals a deep structural property. Since aa must be an integer, s(s1)s(s-1) must be divisible by 10k110^k - 1. This gives us a core congruence relation:

s(s1)0(mod10k1)s(s-1) \equiv 0 \pmod{10^k - 1}

The numbers ss and s1s-1 are always coprime (their GCD is 1). This means that for any prime power pep^e in the prime factorization of M=10k1M = 10^k - 1, pep^e must divide either ss or s1s-1, but not both.

This allows us to find all possible values of ss modulo MM. If MM has rr distinct prime factors, there are 2r2^r solutions to this congruence, which can be found using the Chinese Remainder Theorem (CRT).

We can now formulate an algorithm to find all 2025-numbers up to 16 digits. A pair (s,k)(s, k) generates a valid 2025-number s2s^2 if it satisfies all constraints:

  1. The number of digits of s2s^2 is at most 16. This implies s2<1016s^2 < 10^{16}, which means s<108s < 10^8.
  2. The number of digits of bb is kk. This means 10k1b<10k10^{k-1} \le b < 10^k.
  3. aa and bb are positive integers. This implies s>1s > 1. The condition a1a \ge 1 combined with s>1s > 1 ensures b<sb < s.

The range for kk is also limited. Since a1a \ge 1, we must have s(s1)10k1s(s-1) \ge 10^k-1, which implies ss is roughly 10k=10k/2\sqrt{10^k} = 10^{k/2}. Combining this with s<108s < 10^8, we get 10k/210810^{k/2} \lesssim 10^8, which means k/28k/2 \lesssim 8, or k16k \lesssim 16. We will check kk from 1 to 15.

The final algorithm is as follows:

  1. Initialize an empty set, found_numbers, to store the valid s2s^2 values and avoid duplicates.
  2. Loop through the number of digits for bb, k, from 1 to 15.
  3. For each k, let M=10k1M = 10^k - 1.
  4. Find the prime factorization of MM.
  5. For each prime power factor pep^e of MM, we have two choices for a congruence: s0(modpe)s \equiv 0 \pmod{p^e} or s1(modpe)s \equiv 1 \pmod{p^e}.
  6. Generate all 2r2^r systems of congruences (where rr is the number of distinct prime factors).
  7. For each system, use the Chinese Remainder Theorem to find the unique solution ss modulo MM.
  8. For each solution s:
    1. Check if s<108s < 10^8.
    2. Calculate a=s(s1)Ma = \frac{s(s-1)}{M} and b=sab = s-a.
    3. Check if bb has exactly kk digits: 10k1b<10k10^{k-1} \le b < 10^k.
    4. If all conditions are met, add s2s^2 to the found_numbers set.
  9. After checking all k, the sum of the elements in found_numbers is the answer T(16)T(16).