Number Utilities

Is Triangular

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.

API Endpoint

GET /v1/number/is-triangular

Code Examples

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)

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 is a triangular number?

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.

How do I check if 153 is triangular using MCP?

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.

What's the difference between triangular and perfect square numbers?

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.

Does this handle negative numbers and zero?

The tool typically handles positive integers since triangular numbers are defined for positive sequences. Zero and negatives return false in most implementations.

What's the largest triangular number I can test?

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.

Try Is Triangular Now

Get your free API key and start using Is Triangular in seconds.

Get Free API Key