Calculates the nth square number (n²) with perfect precision. Call via MCP in Cursor or Windsurf, or hit GET /v1/number/square?n=5 for REST. Returns 25 for n=5, 10000 for n=100. Handles arbitrarily large integers without floating-point errors that plague standard math libraries.
curl "https://tinyfn.io/v1/number/square" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/number/square', {
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/square',
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 square calculates n², while square root finds the number that when squared equals the input. This tool gives you 5² = 25, not √25 = 5.
Simply ask Claude to find the nth square number. The MCP tool handles the computation automatically, returning precise integer results without JavaScript's floating-point limitations.
Returns exact results without precision loss. While JavaScript's Math.pow() might introduce floating-point errors at large scales, this tool maintains perfect integer accuracy.
Yes, it handles negative integers correctly. (-5)² returns 25, following standard mathematical rules where negative numbers squared become positive.
GET /v1/number/square?n=VALUE returns JSON with the squared result. Example: ?n=12 returns {"result": 144}.