Skip to content

Instantly share code, notes, and snippets.

@Radcliffe
Created February 2, 2016 18:06
Show Gist options
  • Save Radcliffe/e36f9282edc5963bb4a1 to your computer and use it in GitHub Desktop.
Save Radcliffe/e36f9282edc5963bb4a1 to your computer and use it in GitHub Desktop.
Solution to Crux Mathematicorum M379
"""
Problem M379, Crux Mathematicorum
Proposed by John Grant McLoughlin, University of New Brunswkci,
Fredericton, NB.
The integers 27+C, 555+C, and 1371+C are all perfect squares, the square
roots of which form an arithmetic sequence. Determine all possible values
of C.
"""
from sympy.solvers import solve
from sympy import symbols
x, y, C = symbols('x y C')
system = [(x - y)**2 - (27 + C),
x**2 - (555 + C),
(x + y)**2 - (1371 + C)]
print solve(system)
# Expected output: [{C: 229, x: -28, y: -12}, {C: 229, x: 28, y: 12}]
@Radcliffe
Copy link
Author

We need to solve the following system of equations.

(x-y)^2 = 27 + C
x^2 = 555 + C
(x+y)^2 = 1371 + C

The reader can verify that

(x-y)^2 - 2x^2 + (x+y)^2 = 2y^2 and
(27 + C) - 2(555 + C) + (1371 + C) = 288.

Therefore, 2y^2 = 288, and so y = 12.

Furthermore,

(x+y)^2 - (x-y)^2 = 4xy and
(1371 + C) - (27 + C) = 1344,

hence 4xy = 1344, and so x = 1344 / 48 = 28. Since x^2 = 555 + C, we conclude that C = 28^2 - 555 = 229.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment