2011-09-03

SICP Exercise 1.21: Smallest Divisor

Use the smallest-divisor procedure to find the smallest divisor of each of the following numbers: 199, 1999, 19999.

This exercise is simply a case of invoking the procedure smallest-divisor in an interpreter with the given values. I get the following results:
> (smallest-divisor 199)
199
> (smallest-divisor 1999)
1999
> (smallest-divisor 19999)
7

No comments:

Post a Comment