Guth
NewsDocs
Page actions
View as Markdown ↗
Explore MCP tools ↗

instrument implementation / implementation-contract

GCD/LCM Calculator implementation

A source-bound implementation contract for GCD/LCM Calculator; deployment and executable qualification remain separate.

Status: VERIFIED_CLEANLifecycle: implementation-contract

Binding contract

This record describes what an executable surface must bind and validate. It does not claim that a public calculator, package, or production route is deployed.

Record owner
Guth Instruments
Lifecycle
verified-clean
Evidence ID
t4-057
Effect
Computation or source lookup only

Input and validation requirements

  • Division by zero must be prevented when implementing lcm(a,b)=|ab|/gcd(a,b); the all-zero case requires an explicit convention.
  • An empty input list is invalid and must be rejected because GCD, LCM, and Bezout coefficients are undefined without an agreed empty-list convention.
  • A single integer conflicts with the stated 2+ input requirement and should be rejected or explicitly supported.
  • Inputs must be validated as integers; fractional, NaN, infinity, and nonnumeric values are invalid.
  • For multiple integers, naive multiplication can overflow fixed-width numeric types; arbitrary-precision integers or overflow-safe arithmetic may be required.
  • Negative-input behavior must be specified, especially the sign of GCD and LCM and the nonuniqueness of Bezout coefficients.
  • The all-zero input list needs an explicit policy: gcd(0,...,0) is commonly defined as 0, while Bezout coefficients are nonunique and the LCM convention varies.

Required corrections

No binding erratum is attached to this unique-name record. Implementers must still preserve the declared units, domain, and failure behavior.

Inspectable interface fixture

The sample below is evidence for interface and validation tests, not a production implementation.

{
  "inputs": {
    "integers": [
      84,
      30
    ]
  },
  "expected_outputs": {
    "gcd": 6,
    "lcm": 420,
    "bezout_coefficients": [
      -1,
      3
    ]
  },
  "working": "84 = 2*30 + 24; 30 = 1*24 + 6; therefore gcd = 6. Back-substitute: 6 = 30 - 24 = 30 - (84 - 2*30) = -1*84 + 3*30, so coefficients are [-1,3]. lcm = |84*30|/6 = 2520/6 = 420."
}

Other records

Sources and evidence

These pointers bind the page to evidence. They do not grant authority or collapse verification into deployment.

  • VERIFIED_LEDGER.json
  • evidence-tranche4/tranche4-results.json