Let $S$ be the number of possible solutions for the formula below
$$a * b \equiv c \pmod{x}$$
Where $a,b,c,x \in \mathbb{Z}$ and $0 < a \leq b < x$
I would like to find $c$ and $x$ for which $S/x$ will be the smallest. I tested all the $c$ and $x$ values from $5<x<1,000,000; c < x$ and found that the top smallest $S$ numbers are:
- $x=2*3; c=5; S = 0.16666666666666666$
- $x=2*3*5; c=7; S = 0.13333333333333333$
- $x=2*3*5*7; c=11; S = 0.11428571428571428$
- $x=2*3*5*7*11; c=13; S = 0.1038961038961039$
- $x=2*3*5*7*11*13; c=17; S = 0.0959040959040959$
- $x=2*3*5*7*11*13*17; c=19; S = 0.09026267849797262$
With this clear pattern of prime number series, is there any efficient way to calculate $S$ for bigger numbers?