Skip to content

Fermat's Little Theorem

Enter a natural number p to determine if it's probably prime. Enter k for the number of unique samples of a to try out. The higher the value of k, the more likely the number is prime if all a samples return 1. Press the Calculate button to get the answer. Press the Carmichael button to test a random Carmichael number. Press the Prime button to try a random prime number. Click the Show Solution checkbox to see the complete solution. Press the Clear button to remove the results.

WARNING

This program attempts to handle reasonably large values; however, excessive p and k values could cause this program to stall or even crash. Close the browser tab to recover.