Fermat's Little Theorem: If p is prime and a is not a multiple of p, then   ap-1 = 1 mod p

A composite number n that satisfies    an-1 = 1 mod n is called a base-a pseudoprime.
   For example: 341, 561, 645, 1105

Carmichael numbers are pseudoprime to all bases
   For example: 561, 1105, 1729


Applied Cryptography,
by Bruce Schneier,
Wiley, 1996

Introduction to Algorithms, second edition
by Cormen, Leiserson, Rivest, and Stein
MIT Press/McGraw-Hill, 2001