Example 29: Ramanujan Number Series
Learn how to print a Ramanujan Number Series.
We'll cover the following
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 |
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 80+ hands-on prep courses.