| about | help | code help+videos | done | prefs |
ramanujan
When the mathematical genius Srinivasa Ramanujan was dying of tuberculosis in a hospital, his friend G. H. Hardy, the leading mathematician in England at the time, would visit. C. P. Snow reports that on one of those visits: "Hardy had gone out to Putney by taxi, as usual his chosen method of conveyance. He went into the room where Ramanujan was lying. Hardy, always inept about introducing a conversation, said, probably without a greeting, and certainly as his first remark: 'I thought the number of my taxicab was 1729. It seemed to me rather a dull number.' To which Ramanujan replied: 'No, Hardy! No, Hardy! It is a very interesting number. It is the smallest number expressible as the sum of two cubes in two different ways.'" Since then, integer solutions to: M = I^3 + J^3 = K^3 + L^3 have been called Ramanujan Numbers. Write ramanujan(N) to return a list of all [M, I, J, K, L] tuples that satisfy this relation, sorted by smallest M value first, with the restriction that I,J,K,L are all less than N, the input to the function. So as not to list duplicates, only give answers where I<=J, K<=L, and I<K. ramanujan(10) → [] ramanujan(15) → [[1729, 1, 12, 9, 10]] ramanujan(20) → [[1729, 1, 12, 9, 10], [4104, 2, 16, 9, 15]] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 300 Post-solution available
Copyright Nick Parlante 2017 - privacy