Beta

Taxicab numbers

Description:

1729 is the Hardy–Ramanujan number after a famous anecdote of the British mathematician G. H. Hardy regarding a visit to the hospital to see the Indian mathematician Srinivasa Ramanujan. In Hardy's words:

"I remember once going to see him when he was ill at Putney. I had ridden in taxi cab number 1729 and remarked that the number seemed to me rather a dull one, and that I hoped it was not an unfavorable omen. "No," he replied, "it is a very interesting number; it is the smallest number expressible as the sum of two cubes in two different ways.""

The two different ways are:

1729 = 13 + 123 = 93 + 103

A Ramanujam number (also called taxicab number) can be written two different ways as the sum of two cubes, i.e., there exist distinct a, b, c, and d such that a^3 + b^3 = c ^ 3 + d ^ 3.

Your task is to generate all Ramanujan numbers where 0 < a, b, c, d <= n.

Mathematics
Algorithms

More By Author:

Check out these other kata created by Tavio

Stats:

CreatedJan 10, 2016
PublishedJan 12, 2016
Warriors Trained66
Total Skips7
Total Code Submissions90
Total Times Completed11
Ruby Completions11
Total Stars1
% of votes with a positive feedback rating60% of 5
Total "Very Satisfied" Votes2
Total "Somewhat Satisfied" Votes2
Total "Not Satisfied" Votes1
Total Rank Assessments9
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • Tavio Avatar
Ad