C Program for Ramanujan-like Number Series

1337 views c

1729 is known as the Ramanujan number, after an anecdote of the British mathematician G. H. Hardy when he visited Indian mathematician Srinivasa Ramanujan in hospital. He related their conversation:
"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 unfavourable 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 = 1^3 + 12^3 = 9^3 + 10^3
(Source: https://en.wikipedia.org/wiki/1729_(number))
Next such number is 4104.
4104 = 16^3 + 2^3 = 9^3 + 15^3
I want to find more such numbers. I have tried several time but not able to write code for it. The codes I have written didn't run.

answered question

Show us what you have tried,then we will help.stackoverflow.com/help/how-to-ask

@Gaurav Bahadur Yes I will add my code

1 Answer


Although, You must have shown your work.
Try it:

#include <stdio.h>
int main(){
int i, a, b, x, y, k;

printf("Input nos. between which you want to find Ramanujan No.: ");
scanf("%d %d", &a, &b);



            printf("%d ", i);

return 0;

posted this

Have an answer?


Please login first before posting an answer.