PrimitiveRoot
PrimitiveRoot[n] gives a primitive root of n.
PrimitiveRoot[n, k] gives the smallest primitive root of n greater than or equal to k.
Examples
PrimitiveRoot[7]
(* 3 *)PrimitiveRoot[13, 5]
(* 6 *)Please visit the official Wolfram Language Reference for more details.