Determines if a number is triangular (sum of consecutive integers starting from 1). Access via MCP in Claude Code or Windsurf, or REST at GET /v1/number/is-triangular. Example: 10 is triangular (1+2+3+4=10) while 11 isn't. Returns boolean result with mathematical verification instead of approximation.
curl "https://tinyfn.io/v1/number/is-triangular" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/number/is-triangular', {
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/is-triangular',
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"
}
}
}
}
A triangular number is the sum of consecutive positive integers starting from 1. The nth triangular number equals n(n+1)/2, like 1, 3, 6, 10, 15.
Call the is_triangular tool with parameter 153 in your MCP-enabled editor like Cursor or Cline. It returns false since 153 doesn't equal n(n+1)/2 for any integer n.
Triangular numbers follow n(n+1)/2 pattern (1,3,6,10), while perfect squares follow n² pattern (1,4,9,16). Some numbers like 1 and 36 are both.
The tool typically handles positive integers since triangular numbers are defined for positive sequences. Zero and negatives return false in most implementations.
Limited by integer precision in the implementation, usually safe up to several billion. The algorithm uses the inverse formula to avoid iterating through all triangular numbers.
Get your free API key and start using Is Triangular in seconds.
Get Free API Key