You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sicp-all-tasks/sicp/3_002e71

32 lines
759 B

Exercise 3.71: Numbers that can be expressed as
the sum of two cubes in more than one way are sometimes called
Ramanujan numbers, in honor of the mathematician Srinivasa
Ramanujan.198 Ordered streams of pairs provide an elegant
solution to the problem of computing these numbers. To find a number that can
be written as the sum of two cubes in two different ways, we need only generate
the stream of pairs of integers
(
i
,
j
)
weighted according to the sum
i
3
+
j
3
(see Exercise 3.70), then search the stream for two
consecutive pairs with the same weight. Write a procedure to generate the
Ramanujan numbers. The first such number is 1,729. What are the next five?