Number Utilities

Get Divisors

Returns all positive divisors of a given integer in ascending order. Access via MCP in Cursor or Windsurf, or REST at `/v1/number/divisors`. For example, divisors of 12 are [1, 2, 3, 4, 6, 12]. Essential for mathematical computations where AI agents need exact factor lists instead of approximations.

API Endpoint

GET /v1/number/divisors

Code Examples

curl "https://tinyfn.io/v1/number/divisors" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/number/divisors', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/number/divisors',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's number tools:

{
  "mcpServers": {
    "tinyfn-number": {
      "url": "https://tinyfn.io/mcp/number",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

What are divisors and how does this tool find them?

Divisors are positive integers that divide evenly into a number. This tool returns all divisors in ascending order, from 1 to the number itself.

How do I get divisors of a number using MCP in Cursor?

Use the get_divisors tool with the number parameter. It returns an array of all positive divisors sorted ascending.

What's the difference between divisors and factors?

Mathematically identical - both refer to numbers that divide evenly. This tool returns positive divisors only, excluding negative factors.

Does the tool work with large numbers or have limits?

Works with standard integers, but computation time increases with larger numbers since it must check all potential divisors up to the square root.

What format does the REST API return for divisors?

Returns JSON with a sorted array of integers. For divisors of 20: [1, 2, 4, 5, 10, 20].

Try Get Divisors Now

Get your free API key and start using Get Divisors in seconds.

Get Free API Key