Number Theory API

Endpoints for prime checking, GCD, LCM, factorial, and mathematical computations

Check Prime Number

Determines whether a given integer is a prime number. Returns true or false.

GET
Endpoint: /math/number-theory/is-prime/{number}

Example Request

curl https://api.gstiwari.com/math/number-theory/is-prime/17
Open in Browser

Example Response

{
  "number": 17,
  "isPrime": true
}

Primes Up To Limit

Finds all prime numbers up to the given limit.

GET
Endpoint: /math/number-theory/primes-up-to/{limit}

Example Request

curl https://api.gstiwari.com/math/number-theory/primes-up-to/100
Open in Browser

Example Response

{
  "message": "Primes up to 100",
  "data": [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97],
  "success": true
}

Next Prime

Finds the next prime number after the given number.

GET
Endpoint: /math/number-theory/next-prime/{number}

Example Request

curl https://api.gstiwari.com/math/number-theory/next-prime/23
Open in Browser

Example Response

{
  "success": true,
  "message": "Next prime after 23",
  "data": 29
}

Previous Prime

Finds the previous prime number before the given number.

GET
Endpoint: /math/number-theory/previous-prime/{number}

Example Request

curl https://api.gstiwari.com/math/number-theory/previous-prime/23
Open in Browser

Example Response

{
  "success": true,
  "data": 19,
  "message": "Previous prime before 23"
}

Prime Count

Counts the number of prime numbers up to the given limit.

GET
Endpoint: /math/number-theory/prime-count/{number}

Example Request

curl https://api.gstiwari.com/math/number-theory/prime-count/100
Open in Browser

Example Response

{
  "success": true,
  "message": "Number of primes up to 100",
  "data": 25
}