Algorithms
The /algorithms endpoint provides several algorithms to use as parameters. You can input one or two values depending on the algorithm.
gethttps://api.moxon.dev /v5/algorithms
Try itget/v5/algorithms
curl -X GET \ "https://api.moxon.dev/v5/algorithms"Send the request to see the response here.
methodstringrequiredThe algorithm to use (see available methods below)
- anagram
- bubblesort
- factorial
- gcd
- isprime
- fibonacci
- palindrome
- primelist
- primefactors
- reverse
- roman
valuestringrequiredThe value to use in the algorithm. Must contain at least one character
value2stringoptionalThe second value to use if necessary. Must contain at least one character
| Method | Description | Requires value2 | Limits |
|---|---|---|---|
anagram | Checks if two strings are anagrams | Yes | Max 1000 chars |
bubblesort | Sorts an array of numbers, separated by commas | No | Max 1000 elements |
factorial | Calculates the factorial of a number between 0 and 170 | No | 0–170 |
gcd | Computes the greatest common divisor of two numbers | Yes | 1–100,000 |
isprime | Checks if a number is prime | No | 1–100,000 |
fibonacci | Calculates a Fibonacci sequence up to a given number | No | 0–1000 |
palindrome | Checks if a string is a palindrome | No | Max 1000 chars |
primelist | Returns a list of prime numbers up to a given number | No | 2–10,000 |
primefactors | Returns the list of prime factors of a number | No | 1–100,000 |
reverse | Reverses a string | No | Max 1000 chars |
roman | Converts between Roman numerals and numbers (1–3999) | No | 1–3999 |
answernumber|string|boolean|number[]The algorithm result
If parameters are missing or invalid, the API will return an error:
- 400
Please provide a valid algorithm (?method={algorithm})Themethodparameter is missing or invalid - 400
Invalid inputThe value exceeds the method's constraints or limits - 400
Value must be a numberfactorial/isprime:valueis not numeric - 400
Value must be an integerfactorial/isprime:valueis not a whole number - 400
Number must be positivefactorial/isprime:valueis negative (or zero forisprime) - 400
Number must be between 0 and 170factorial:valueis out of range - 400
Number must be between 1 and 100000isprime:valueis out of range
Last updated on July 26, 2026