SICP Exercise 1.27 (Carmichael Numbers)



Exercise 1.27.  Demonstrate that the Carmichael numbers listed in footnote 47 really do fool the Fermat test. That is, write a procedure that takes an integer n and tests whether an is congruent to a modulo n for every a<n, and try your procedure on the given Carmichael numbers.

SOLUTION

The code and tests are here.

Observations
============

The above program demonstrates that the Carmichael numbers 561, 1105....to 6601 fool the Fermat test. These are all composite numbers that pass the Fermat test.

Comments

Popular posts from this blog

SICP Exercise 4.18 a alternative strategy for interpreting internal definitions

SICP Exercise 3.11 make-account internal definitions with local state

SICP Exercise 3.13 make-cycle