## Teaser 2990: Squares and cubes

**From The Sunday Times, 12th January 2020** [link]

Jenny is pleased that she has found two whole numbers with a remarkable property. One of them is a single digit greater than zero while the other one has two digits. The remarkable thing is that the difference of their squares is a perfect cube and the difference of their cubes is a perfect square.

Her sister Sarah is not impressed, however. She has found two three-digit numbers for which the difference of their squares is also a perfect cube and the difference of their cubes is also a perfect square.

In ascending order, what are the four numbers?

[teaser2990]

## Jim Randell 5:24 pm

on10 January 2020 Permalink |We can the [[

`SubstitutedExpression()`

]] solver from theenigma.pylibrary to solve this puzzle.The following Python program runs in 623ms.

Run:[ @repl.it ]Solution:The four numbers are: 6, 10, 384, 640.Jenny’s numbers are 6 and 10:

Sarah’s numbers are 384 and 640:

They are related in that Sarah’s numbers are 64 (=2⁶) times Jenny’s.

For any

(n, m)solution, then(k.n, k.m)is also a solution, wherek = z⁶.This method accounts for the first three solutions (by increasing

x):but not all solutions are multiples of (6, 10) – the next few are:

LikeLike

## Jim Randell 10:20 pm

on11 January 2020 Permalink |The following Python program generates

(n, m)and(x, y)pairs where:It runs in 104ms to solve this puzzle, but the [[

`generate()`

]] function can be used to generate larger numbers with the required property.Run:[ @repl.it ]LikeLike

## GeoffR 9:32 am

on12 January 2020 Permalink |LikeLike