Math
Endpoints for various math functions.
Base URL
/prime
Calculates if n
is a prime.
Example:
GET /math/prime/20
Response:
Constraints:
n
must be > 1n
must be a number
Errors:
400
: Invalid parameter
/fibonacci
Calculates the first n
digits in the Fibonacci Sequence
Example:
GET /math/fibonacci/5
Response:
Constraints:
0 <
n
< 1476n
must be a number
Errors:
400
: Invalid parameter
/random-number
Generates a random number between x
and y
(if x
and y
are omitted, x=0 y=1000
)
Example:
GET /math/random-number?min=10&max=100
Response:
Constraints:
x (min)
<y (max)
x
andy
must be numbers
Errors:
400
: Invalid parameter(s)
/factorial
Calculates the factorial of n
(n!
)
Example:
GET /math/factorial/5
Response:
Constraints:
0 <
n
< 170n
must be a number
Errors:
400
: Invalid parameter
/sqrt
Calculates the square root of n
Example:
GET /math/sqrt/25
Response:
Constraints:
n
> 0n
must be a number
Errors:
400
: Invalid parameter
/abs
Calculates the absolute value of n
Example:
GET /math/abs/-5
Response:
Constraints:
n
must be a number
Errors:
400
: Invalid parameter
/round
Rounds n
to the nearest integer
Example:
GET /math/round/5.5
Response:
Constraints:
n
must be a number
Errors:
400
: Invalid parameter
/ceil
Rounds n
up to the nearest integer
Example:
GET /math/ceil/5.1
Response:
Constraints:
n
must be a number
Errors:
400
: Invalid parameter
/floor
Rounds n
down to the nearest integer
Example:
GET /math/floor/5.9
Response:
Constraints:
n
must be a number
Errors:
400
: Invalid parameter
/sin
Calculates the sine of n
(in radians)
Example:
GET /math/sin/0
Response:
Constraints:
n
must be a number
Errors:
400
: Invalid parameter
/cos
Calculates the cosine of n
(in radians)
Example:
GET /math/cos/0
Response:
Constraints:
n
must be a number
Errors:
400
: Invalid parameter
/tan
Calculates the tangent of n
(in radians)
Example:
GET /math/tan/0
Response:
Constraints:
n
must be a number
Errors:
400
: Invalid parameter
/log
Calculates the natural logarithm of n
Example:
GET /math/log/10
Response:
Constraints:
n
> 0n
must be a number
Errors:
400
: Invalid parameter
/log10
Calculates the base 10 logarithm of n
Example:
GET /math/log10/10
Response:
Constraints:
n
> 0n
must be a number
Errors:
400
: Invalid parameter
/log2
Calculates the base 2 logarithm of n
Example:
GET /math/log2/10
Response:
Constraints:
n
> 0n
must be a number
Errors:
400
: Invalid parameter
/exp
Calculates e
raised to the power of n
Example:
GET /math/exp/1
Response:
Constraints:
n
must be a number
Errors:
400
: Invalid parameter
/pow
Calculates x
raised to the power of y
Example:
GET /math/pow/?base=2&exponent=3
Response:
Constraints:
x
andy
must be numbersx
andy
must be present
Errors:
400
: Invalid parameter(s)
Last updated