Maths Olympiad Prep

Library / HMMT February /981 of 1302

HMMT February

Geometry Difficulty 5.5 AIME, harder Find the answer United States

Problem:
For an integer nn, let f(n)f(n) denote the number of pairs (x,y)(x, y) of integers such that x2+xy+y2=nx^{2}+x y+y^{2}=n. Compute the sum
∑n=1106nf(n) \sum_{n=1}^{10^{6}} n f(n)
Write your answer in the form a⋅10ba \cdot 10^{b}, where bb is an integer and 1≤a<101 \leq a<10 is a decimal number.
If your answer is written in this form, your score will be max⁡{0,25−⌊100∣log⁡10(A/N)∣⌋}\left.\max \left\{0,25-\left\lfloor 100\left|\log _{10}(A / N)\right|\right\rfloor\right\}\right., where N=a⋅10bN=a \cdot 10^{b} is your answer to this problem and AA is the actual answer. Otherwise, your score will be zero.

A number or a short expression. Fractions can be typed as 3/2, and spacing doesn't matter.

Solution

Solution:
Answer: 1.813759629294⋅10121.813759629294 \cdot 10^{12}

Rewrite the sum as
∑x2+xy+y2≤106(x2+xy+y2), \sum_{x^{2}+x y+y^{2} \leq 10^{6}}\left(x^{2}+x y+y^{2}\right),
where the sum is over all pairs (x,y)(x, y) of integers with x2+xy+y2≤106x^{2}+x y+y^{2} \leq 10^{6}. We can find a crude upper bound for this sum by noting that
x2+xy+y2=34x2+(x2+y)2≥34x2 x^{2}+x y+y^{2}=\frac{3}{4} x^{2}+\left(\frac{x}{2}+y\right)^{2} \geq \frac{3}{4} x^{2}
so each term of this sum has ∣x∣≤23103|x| \leq \frac{2}{\sqrt{3}} 10^{3}. Similarly, ∣y∣≤23103|y| \leq \frac{2}{\sqrt{3}} 10^{3}. Therefore, the number of terms in the sum is at most
(43103+1)2≈106 \left(\frac{4}{\sqrt{3}} 10^{3}+1\right)^{2} \approx 10^{6}
(We are throwing away "small" factors like 163\frac{16}{3} in the approximation.) Furthermore, each term in the sum is at most 10610^{6}, so the total sum is less than about 101210^{12}. The answer 1⋅10121 \cdot 10^{12} would unfortunately still get a score of 0.

For a better answer, we can approximate the sum by an integral:
∑x2+xy+y2≤106(x2+xy+y2)≈∬x2+xy+y2≤106(x2+xy+y2)dydx \sum_{x^{2}+x y+y^{2} \leq 10^{6}}\left(x^{2}+x y+y^{2}\right) \approx \iint_{x^{2}+x y+y^{2} \leq 10^{6}}\left(x^{2}+x y+y^{2}\right) d y d x
Performing the change of variables (u,v)=(32x,12x+y)(u, v)=\left(\frac{\sqrt{3}}{2} x, \frac{1}{2} x+y\right) and then switching to polar coordinates (r,θ)=(u2+v2,tan⁡−1(v/u))(r, \theta)=\left(\sqrt{u^{2}+v^{2}}, \tan ^{-1}(v / u)\right) yields
∬x2+xy+y2≤106(x2+xy+y2)dydx=23∬u2+v2≤106(u2+v2)dvdu=23∫02π∫0103r3drdθ=4π3∫0103r3dr=π3⋅1012 \begin{aligned} \iint_{x^{2}+x y+y^{2} \leq 10^{6}}\left(x^{2}+x y+y^{2}\right) d y d x & =\frac{2}{\sqrt{3}} \iint_{u^{2}+v^{2} \leq 10^{6}}\left(u^{2}+v^{2}\right) d v d u \\ & =\frac{2}{\sqrt{3}} \int_{0}^{2 \pi} \int_{0}^{10^{3}} r^{3} d r d \theta \\ & =\frac{4 \pi}{\sqrt{3}} \int_{0}^{10^{3}} r^{3} d r \\ & =\frac{\pi}{\sqrt{3}} \cdot 10^{12} \end{aligned}
This is approximately 1.8138⋅10121.8138 \cdot 10^{12}, which is much closer to the actual answer. (An answer of 1.8⋅10121.8 \cdot 10^{12} is good enough for full credit.)

The answer can also be computed exactly by the Common Lisp code:
```
(defconstant +MAX+ 1e6)
(defvar +lower+ -2000)
(defvar +upper+ 2000)
(princ
(loop for x from +lower+ to +upper+ sum
(loop for y from +lower+ to +upper+
sum
(let ((S (+ ( x x) ( x y) (* y y))))
(if (and (<= S +MAX+) (> S 0)) S 0))))
```

Want a route through all this instead of an archive? The track puts 2,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.