Prime factorisation

Split a whole number up to 10^15 into its prime factors, and check whether it is prime.

Input

A whole number from 1 to 1,000,000,000,000,000.

Result

Fill in the input and press Run.

Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.

Use it from code or an agent

curl -s https://setget.net/v1/tools/prime-factors \
  -H 'Content-Type: application/json' \
  -d '{"input":{"number":360}}'
import json, urllib.request

body = {'input': {'number': 360}}
request = urllib.request.Request("https://setget.net/v1/tools/prime-factors", json.dumps(body).encode(),
                                 {"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/prime-factors", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"number":360}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "prime-factors",
  "input": {
    "number": 360
  }
}
{
  "input": {
    "number": 360
  }
}

Endpoint: POST /v1/tools/prime-factors. Over MCP: run_tool with slug: "prime-factors". Machine-readable: input schema, Markdown. Connect an agent.

Inputs

NameTypeRequiredWhat it does
number integer yes A whole number from 1 to 1,000,000,000,000,000. From 1 to 1000000000000000.

Examples

Input
{
  "number": 360
}
Result
{
  "number": 360,
  "is_prime": false,
  "factors": [
    {
      "prime": 2,
      "exponent": 3
    },
    {
      "prime": 3,
      "exponent": 2
    },
    {
      "prime": 5,
      "exponent": 1
    }
  ],
  "text": "2^3 * 3^2 * 5",
  "divisors": 24
}

A larger number

Input
{
  "number": 600851475143
}
Result
{
  "number": 600851475143,
  "is_prime": false,
  "factors": [
    {
      "prime": 71,
      "exponent": 1
    },
    {
      "prime": 839,
      "exponent": 1
    },
    {
      "prime": 1471,
      "exponent": 1
    },
    {
      "prime": 6857,
      "exponent": 1
    }
  ],
  "text": "71 * 839 * 1471 * 6857",
  "divisors": 16
}

A prime

Input
{
  "number": 1000000007
}
Result
{
  "number": 1000000007,
  "is_prime": true,
  "factors": [
    {
      "prime": 1000000007,
      "exponent": 1
    }
  ],
  "text": "1000000007",
  "divisors": 2
}

Questions

Is 1 a prime number?
No. A prime has exactly two divisors, 1 and itself, and 1 has only one. It has no prime factors.
What is the largest number accepted?
1,000,000,000,000,000 (10^15). The answer is exact for every number in that range.
What does "divisors" count?
Every whole number that divides it exactly, including 1 and the number itself.