Let

be a prime number. Let

be the number of pairs

such that

and

. Let

be the cardinality of the set

. Prove that

.
Step 1. Reformulate the Definitions
Let

be a prime. Define:
·

: number of pairs

with

such that

.
·

: number of distinct residues modulo

among the factorials

.
Note that

, and since

, we can extend the set to include 0! . Thus, the set of factorials becomes:

.
This set still has exactly

distinct elements.
---
Step 2. Rewrite

in Terms of Factorials
For

, observe:

.
So the condition becomes:

.
Let

and

. Then:
·

·

So

counts the number of pairs

with

such that:

.
---
Step 3. Count the Repeated Values
Let

, the number of distinct values among

. Denote these distinct values by

.
For each

, let

be the number of indices

such that

. Then:

.
The number of pairs

with

such that

is:

.
Multiplying both sides by 2:

.
---
Step 4. Apply the Cauchy–Schwarz Inequality
We have:
·

·

By the Cauchy–Schwarz inequality:

.
Substituting the known values:

.
Since

, we conclude:

.