Retrieves the nth prime number through deterministic computation. Access via MCP in Cursor or Windsurf for AI-powered mathematical workflows, or call GET /v1/number/nth-prime with position parameter. Returns exact primes up to large positions without approximation — the 1000th prime is 7919, computed precisely every time.
curl "https://tinyfn.io/v1/number/nth-prime" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/number/nth-prime', {
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/nth-prime',
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"
}
}
}
}
Nth prime finds the prime at a specific position (e.g., 10th prime = 29), while primality testing checks if a given number is prime. Use nth prime for sequence generation, primality testing for validation.
Call the nth-prime tool with position parameter 100. The AI agent will return 541, the exact 100th prime, computed deterministically without needing to generate all preceding primes.
The tool handles large positions efficiently, though response time increases with position. Positions up to several thousand work reliably — practical limits depend on your timeout settings.
Uses 1-based indexing where position 1 returns 2 (first prime), position 2 returns 3 (second prime), etc. This matches mathematical convention for prime sequences.
This endpoint returns a single prime at the specified position. For ranges or multiple primes, make separate calls or use other prime-related tools if available.