Formula for probability of relatively prime integer being a Fermat liar

From Number

Statement

Version for odd composite numbers

Suppose is an odd composite natural number with prime factorization:

where the are distinct primes and the are nonnegative integers.

Then, for chosen uniformly at random among , the probability that is a Fermat liar mod (or equivalently, is a Fermat pseudoprime to base ), or explicitly the probability that , is:

where is the universal exponent.

Version for even composite numbers

Fill this in later