Maths Olympiad Prep

Library / /1050 of 1394

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 a10ba \cdot 10^{b}, where bb is an integer and 1a<101 \leq a<10 is a decimal number.
If your answer is written in this form, your score will be max{0,25100log10(A/N)}\left.\max \left\{0,25-\left\lfloor 100\left|\log _{10}(A / N)\right|\right\rfloor\right\}\right., where N=a10bN=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.81375962929410121.813759629294 \cdot 10^{12}

Rewrite the sum as
x2+xy+y2106(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+y2106x^{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)234x2 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 x23103|x| \leq \frac{2}{\sqrt{3}} 10^{3}. Similarly, y23103|y| \leq \frac{2}{\sqrt{3}} 10^{3}. Therefore, the number of terms in the sum is at most
(43103+1)2106 \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 110121 \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+y2106(x2+xy+y2)x2+xy+y2106(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,tan1(v/u))(r, \theta)=\left(\sqrt{u^{2}+v^{2}}, \tan ^{-1}(v / u)\right) yields
x2+xy+y2106(x2+xy+y2)dydx=23u2+v2106(u2+v2)dvdu=2302π0103r3drdθ=4π30103r3dr=π31012 \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.813810121.8138 \cdot 10^{12}, which is much closer to the actual answer. (An answer of 1.810121.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,000 problems in a working order, from AMC 10 level to the IMO shortlist.

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