Skip to content

Latest commit

 

History

History

two-cube-sums

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Create a function

boolean hasTwoCubeSums(int n)

which checks if a given number n can be written as the sum of two cubes in two different ways: n = a³+b³ = c³+d³. All the numbers a, b, c and d should be different and greater than 0.

E.g. 1729 = 9³+10³ = 1³+12³.

hasTwoCubeSums(1729); // true
hasTwoCubeSums(42);   // false