Close

Prime Factors

Returns the complete prime factorization of a number.

API

Endpoint
https://pebbles.cc/api/prime-factors
Parameters

Send a request with the following parameters:

apikey - Your API key

number - The number to be factored, a positive integer.

mode - Set to complete if you want the list of prime factors with multiplicity. Set to unique if you want the list of prime factors without multiplicity. Defaults to complete.

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 - a comma seperated list of the prime factors.

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" : "2, 3, 5" }

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