Example 29: Ramanujan Number Series

Learn how to print a Ramanujan Number Series.

Problem

The Ramanujan number is the smallest number expressed as the sum of two cubes in two different ways.

Write a program to print all such numbers up to 20.

Example

Input Output
20 13123=93103=17291^{3} * 12^{3} = 9^{3} * 10^{3} = 1729

Try it yourself

Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.

Note: Try to generate the Ramanujan Numbers series in the coding widget given below. The order, however, does not matter as it depends on your logic.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.