How to verify if g is a generator for p? For learning purpose, supposed I have a 16-digit prime which is 2685735182215187, how do I verify if g is a generator? (p is supposedly a special kind of prime)
Steps:


Factor $p-1$, that is, find the primes which, multiplied together, produce $p-1$.  In your case, $2685735182215186 = 2 \times 1342867591107593$
For each prime factor $q$ of $p-1$, verify that $g^{(p-1)/q} \not\equiv 1\pmod p$


If every such $q$ verifies (that is, they were all not 1), then $g$ is a generator.