Returns all prime numbers within a specified range using efficient sieve algorithms. Access via MCP in Cursor or Windsurf, or call GET /v1/number/primes-in-range with start and end parameters. For example, range 10-30 returns [11, 13, 17, 19, 23, 29]. Deterministic computation eliminates AI hallucination of incorrect prime sequences.
curl "https://tinyfn.io/v1/number/primes-in-range" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/number/primes-in-range', {
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/primes-in-range',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
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"
}
}
}
}
Call the primes-in-range tool with start and end parameters. Claude Code and other MCP clients will return the exact prime array without guessing.
The tool handles ranges efficiently up to reasonable computational limits. Very large ranges may timeout, so break them into smaller chunks if needed.
Yes, both start and end values are included if they're prime. Range 2-7 returns [2, 3, 5, 7] since all endpoints are prime.
Returns a JSON array of integers in ascending order. Empty ranges return an empty array [].
AI often generates incorrect prime sequences or misses numbers. This tool uses proven algorithms to guarantee mathematically accurate results every time.
Get your free API key and start using Primes In Range in seconds.
Get Free API Key