Le Monde puzzle [#944]
A completely dull Le Monde mathematical puzzle:
Find all integer pairs (a,b) less than 10⁶ such that a-b=2015 and ab is a perfect square.
If I write the only condition as the function
perfect=function(c){ return(c==trunc(sqrt(c))^2)}
and brute-force checked for all possible solutions
for (A in 2015:1e6) if (perfect(A*(A-2015))) print(A) trunc(y/10)*11+(y-10*trunc(y/10))-(y==10*trunc(y/10))}
which produced
[1] 2015 [1] 2304 [1] 2420 [1] 2511 [1] 3627 [1] 4212 [1] 7056 [1] 7595 [1] 16640 [1] 33759 [1] 41616 [1] 79092 [1] 204020
as the 13 possible answers. If one checks between 10⁶ and 5 10⁶, the only remaining solution is 1,016,064. Which is the highest possible one according to Le Monde.
January 20, 2016 at 7:15 pm
Proving analytically that a=1,016,064 is the largest possible value of a is a bit less dull. Here’s one way to do so:
We have b(b+2015)=c^2 for some c. Note that b (and hence a) is maximized if and only if c is maximized, so let’s try to maximize c. Note that any common divisor of b and b+2015 must also divide 2015. Let n be the largest such common divisor and put b=nd. Then n^2[d(d+2015/n)]=c^2, and we see that d(d+2015/n) must also be a square. But since d and d+2015/n do not share a common divisor, they must each be a square. Now, for a fixed n, maximizing c comes down to maximizing d(d+2015/n), which in turn reduces to maximizing d. But since d and d+2015/n are both square, d is maximized if and only if d and d+2015/n are *consecutive* squares. This means that d = e^2 and d+2015/n = e^2+2e+1, for some e, which in turn implies that e=2015/2n – 1/2. But this, in turn, implies that d = (2015/2n – 1/2)^2. Thus, for each n, we have that d and hence d(d+2015/n) is maximized when d=(2015/2n – 1/2)^2. This implies that, for each n, b is maximized when b = n*(2015/2n – 1/2)^2. Moreover, this implies that a is maximized when a = n*(2015/2n – 1/2)^2 + 2015. Now let’s maximize over n. Clearly, n*(2015/2n – 1/2)^2 + 2015 is maximized when n=1 (the only possibilities are n=1, 5, 13, 31, 65, 155, 403, or 2015, since n must be a divisor of 2015). Therefore, the maximum of a is 1*(2015/2 – 1/2)^2 + 2015 = 1,016,064.
January 20, 2016 at 8:15 pm
Thank you, this is indeed the only interesting point in the problem!
January 20, 2016 at 8:59 pm
A slightly faster argument is to derive from 2015=c²-b²=(c-b)(c+b) that c+b is a divider of 2015, i.e. 5, 13, 31, 65, 155, 403, or 2015. When c+b=2015, we do recover 1,016,064.