Fermat's Little Theorem and Carmichael Numbers

What an amazing kid!

I wasn’t familiar with Carmichael numbers, so I did some research.

https://en.wikipedia.org/wiki/Carmichael_number

states that if p is a prime number, then for any integer b, the number bp − b is an integer multiple of p.

For example, p is 7. 7 is prime, indeed! Then, for any integer b, let’s try 3, the number 3 to the power of 7 minus 3 is an integer multiple of 7. Wow. Ok, 3 to 7 is 2187 (in JavaScript console, dot this: 3**7, which gives us 2187). So, 2187 minus 3 is 2184. Can we divide that by 7 and get back an integer? Yes, that is 728! It works.

Carmichael numbers are composite numbers which have this property. So, they are not prime, but are basically associated with primes?

In math, composite numbers can be defined as numbers that have more than two factors. A composite number is the opposite of a prime. My insecurities wanted to add “OBVIOUSLY” to the end of that phrase, but I kept that in check.

In 1910, Carmichael found the first and smallest such number, 561, which explains the name “Carmichael number”.

List of first 8 Carmicheal numbers:

k
3 -> 561 = 3 *11 *17
4 -> 41041 = 7 * 11 * 13 * 41
5 -> 825265 = 5 * 7 * 17 * 19 * 73
6 -> 321197185 = 5 * 19 * 23 * 29 * 37 * 137
7 -> 5394826801 = 7 * 13 * 17 * 23 * 31 * 67 * 73
8 -> 232250619601 = 7 * 11 * 13 * 17 * 31 * 37 * 73 * 163

I looked at that last one, where k=8, and wondered: how many primes are there in between 73 and 163?

This link has a list of all the primes:

http://aleph0.clarku.edu/~djoyce/numbers/primes.html

These are the numbers in between

79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157

16 numbers. It would be interesting if there was a property like the gap between each one was a prime number minus 1. 17 is prime. Let’s try it out on some others. Let’s gather a little extra information. Those are the 7th and 8th numbers.

What if we use k=5. And, choose the gap between 4th and 5th? In that case we have these numbers:

23 29 31 37 41 43 47 53 59 61 67 71.

There are 12 there. 13 is prime. Hmm.

What about k=4?

17 19 23 29 31 37 41

There are 7. Drat, 7+1 isn’t a prime number!

I thought perhaps we could generalize this if k is odd or even. but nothing there. I guess I am no Daniel Larsen.