13
2
Background
Ramanujan's number, 1729, is called a taxi-cab number due to the (possibly apocryphal) tale of Hardy boarding a cab to visit Ramanujan in hospital having this number, which seemed bland to him.
It's since known as the most famous of a class of integers known as "taxicab numbers" which are expressible as the sum of two nth powers (of positive integers) in two (or sometimes 'k') different ways.
1729 is the smallest natural number expressible as the sum of 2 cubes in 2 different ways, making it the first "3,2" taxicab number ("n,k" being general).
Challenge
Given a number, decide whether it is a "3,2" 'secondary taxicab number' - meaning it fulfills the same constraint as 1729 (2 unique sums of cubes), but does not have to be the smallest such integer of the "3,2" class (that being 1729, of course).
Example cases:
1729 = 10^3 + 9^3 = 12^3 + 1^3
4104 = 15^3 + 9^3 = 16^3 + 2^3
13832 = 2^3 + 24^3 = 18^3 + 20^3
As well as 20683, 32832, 39312...
Scoring
This is code-golf, so the shortest answer in each language wins.
Rough Matlab code to find other cases by brute force:
for k = 1729:20000
C = sum(round(mod(real((k-[1:ceil(k^(1/3))].^3).^(1/3)),1)*10000)/10000==1);
if C > 1
D = (mod(C,2)==0)*C/2 + (mod(C,2)==1)*((C+1)/2);
disp([num2str(k),' has ',num2str(D),' solns'])
end
end
Welcome to PPCG! I edited your question a bit to make it a bit more clear. Would you be willing to add some test cases? – musicman523 – 2017-06-14T02:59:21.150
Yep, I was struggling because I'm at work and don't have Matlab, but managed to get Octave online to work and found 4104=16^3+4^3=15^3+9^3 – DrQuarius – 2017-06-14T03:11:45.220
1729 sould be true or false? – J42161217 – 2017-06-14T03:33:24.290
True. All non-taxicabs false. – DrQuarius – 2017-06-14T04:02:23.277
If 1729 is true, then can you explain (or alter/remove)
but is not the smallest such integer of the "3,2" class (that being 1729, of course)
? Thanks! – musicman523 – 2017-06-14T04:59:43.297Good point, sorry about that! – DrQuarius – 2017-06-14T05:42:40.087
As far as I can tell, the two answers interpreted the spec differently. Should 87539319 = 167³ + 436³ = 228³ + 423³ = 255³ + 414³ return true or false? – Dennis – 2017-06-14T06:05:43.683
Yes, that should be a true, I could have clarified "3,2" as a sum of two cubes in "at least** two ways". – DrQuarius – 2017-06-14T06:58:50.370
2A001235 – Shaggy – 2017-06-14T07:06:37.877
"Both men were mathematicians and liked to think about numbers." - This was the point I got to before I had to check whether I was on Simple English Wikipedia. Anyone else? – user253751 – 2017-06-14T07:17:43.777
1Do there need to be exactly two ways to write the number, or at least two? – John Dvorak – 2017-06-14T08:19:26.347
2
someone should write an answer in Taxi https://bigzaphod.github.io/Taxi/
– SaggingRufus – 2017-06-14T12:54:27.093