GCD and LCM Calculator: API and MCP
GCD and LCM Calculator over REST and MCP: input fields, limits, outputs, one example request and its real answer. Free, no sign-up.
GET /api/v1/tools/math.gcd-lcm/mcp/math
- Id
math.gcd-lcm- Version
- 1.0.0
- Access
- Free
- Tool page
- GCD and LCM Calculator
- Schema
GET /api/v1/tools/math.gcd-lcm
Input
| Field | Type | Constraints | Default | Description |
|---|---|---|---|---|
numbers (required) | array | Numbers |
Output
| Field | Type | Description |
|---|---|---|
gcd | number | GCD (greatest common divisor) |
lcm | number | LCM (least common multiple) |
count | number | Count of numbers |
Example request
curl -X POST https://hesaplayici.com/api/v1/tools/math.gcd-lcm/execute \
-H 'Content-Type: application/json' \
-d '{"input":{"numbers":[24,30]},"locale":"en"}'Example answer
{
"output": {
"gcd": 6,
"lcm": 120,
"count": 2
},
"steps": [
{
"id": "factors.1",
"formula": "n₁ = product of its prime factors",
"substitution": "24 = 2³ × 3",
"value": 24
},
{
"id": "factors.2",
"formula": "n₂ = product of its prime factors",
"substitution": "30 = 2 × 3 × 5",
"value": 30
},
{
"id": "gcd",
"formula": "GCD = product of the common prime factors, each with its lowest power",
"substitution": "GCD = 2 × 3",
"value": 6
},
{
"id": "lcm",
"formula": "LCM = product of all prime factors, each with its highest power",
"substitution": "LCM = 2³ × 3 × 5",
"value": 120
},
{
"id": "euclid.1",
"formula": "GCD(x, y) = GCD(y, x mod y)",
"substitution": "GCD(24, 30): 30 = 1 × 24 + 6; 24 = 4 × 6 + 0",
"value": 6
}
],
"notes": [],
"meta": {
"toolVersion": "1.0.0",
"locale": "en"
},
"citation": {
"url": "https://hesaplayici.com/en/math/gcd-lcm-calculator",
"title": "GCD and LCM Calculator"
}
}