Question: Problem 9 - Bonus points ( Ramanujan Number ) Srinivasa Ramanujan was an Indian mathematician who became famous for his intu - ition for numbers.
Problem Bonus points
Ramanujan Number
Srinivasa Ramanujan
was an Indian mathematician who became famous for his intu
ition for numbers. When the English mathematician
G H Hardy
came to visit him one
day,
Hardy
remarked that the number of his taxi was
a rather dull number. To
which
Ramanujan
replied,
No Hardy! It is a very interesting number. It is
the smallest number expressible as the sum of two cubes in two different ways
Verify this claim by writing a program named
ramanujan.cpp
that accepts
n
int from
commandline arguments and writes to standard output all integers less than or equal to
n
that can be expressed as the sum of two cubes in two different ways. In other words, find
distinct positive integers
a b c
and
d
such that
a
b
c
d
n
Your program should report the message
Invalid value of n
if
n
workspacecschw
go outramanujanout srcramanujancpp
outramanujanout
outramanujanout
Invalid value of N
Hins:
Use four nested
for
loops with these bounds on the loops variables:
a
n
a b
n
a
a c
n
and
c d
n
c
Do not explicitly compute cube roots use
xxx y
instead of using
x cbrty
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
