Close

Euler's Criterion / Legendre Symbol Calculator

Euler's Criterion helps determine if an integer(a) is a quadratic residue modulo an odd prime(p) or not.
This is done by calculating the value of the Legendre symbol \( \mathsf{(\frac{a}{p})}\) .
A value of 1 indicates a is a quadratic residue modulo p.
A value of -1 indicates a is a non-quadratic residue modulo p.
A value of 0 indicates a $\equiv$ 0 (mod p).
Note: a should not be a multiple of p, else a value of 0 is returned.

API

Endpoint
https://pebbles.cc/api/legendre-symbol
Parameters

Send a request with the following parameters:

apikey - Your API key

numerator - The number to test, a positive integer.

denominator - The prime number (not 2).

Response

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.

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 "|".

Examples

{ "status" : "success", "output" : "-1" }

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