Primitive Roots Calculator

Returns the primitive root(s) of a number n, which is equivalent to finding the generator(s) of the multiplicative group $(\mathbb{Z}/n\mathbb{Z})^\times$. Works for both prime numbers and composites with primitive roots.



Send a request with the following parameters:

apikey - Your API key

number - The number, a positive integer.


The API returns a JSON object containing the fields status and output.

When the operation is successful, status has a value of "success", and output holds the result of the operation - a comma seperated list of the primitive roots.

When there is an error in the operation, status has a value of "error", and output holds the error message(s). Multiple error messages are seperated with a "|".


{ "status" : "success", "output" : "2, 3" }

{ "status" : "error", "output" : "Invalid input | API key not stated" }