To the Top

Integer Factorization to Prime Factors with API

The Number factor online tool is also availble in Chinese: 整数因式分解在线工具

Buy Me A Coffee

Positive Integers (or Natural Numbers) can be factorized. For example: Number 12 when factorized becomes: 12 = 2 * 2 * 3 or 22 * 31. The 2 and 3 are prime numbers. Every positive numbers can be uniquely factorized by using the prime factors.

The following online integer factorization will try first prime number 2, then 3, 5 and so on. Each prime, if that is one factor, will be divided by the original number and printed out. The process goes until the number becomes one. The factorization algorithm can be expressed by the following Python code.

The algorithm to do a integer factorization with O(sqrt(N)) complexity: Integer/Prime Factorization Algorithm

def factor(n):
   p = next_prime()    # first prime which is 2
   while n > 1:
      while n % p == 0:
         print(p)
         n /= p
      p = next_prime()  # yield the next prime 3, 5, 7 ...     
Luckily, we can use the following online factorization tool - and with API that is free to use (subject to fair use policy):

Enter Integers (separated by space)

Integer Factorization (API)

We provide a simple API (subject to fair use policy) that factorizes a integer.

API example:
  https://api.justyy.workers.dev/api/factor/?cached&n=9223372036854775807
returns: 
{
  "result": "9223372036854775807: 7 7 73 127 337 92737 649657",
  "cached": false
}
You can factor many integers at the same time
API example:
  https://api.justyy.workers.dev/api/factor/?cached&n=1+2+3+4+5
returns: 
{
  "result": "1:\n2: 2\n3: 3\n4: 2 2\n5: 5",
  "cached": false
}

You can call the Converter API via the POST method, for example:

? curl -s -X POST https://api.justyy.workers.dev/api/factor/ -d "n=9223372036854775807"
{
  "result": "9223372036854775807: 7 7 73 127 337 92737 649657",
  "cached": false
}

If you are using POST method, the result will not be cached via the CloudFlare CDN, as the GET method does (via ?cached URL).

Number Factorization API Servers

You can use one of the following API calling servers.

  1. Load Balancer: https://api.justyy.workers.dev/api/

Share: List of Many Other Online Tools