docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Provide a small utility module that handles common number theory tasks and exposes consistent integer division semantics for mixed-sign inputs.
48 and 18 returns 6, and both arguments may be zero with the degenerate case producing 0. @test-48 and 18 still returns the positive shared divisor 6. @test21 and 6 returns 42 and is always non-negative. @test0 yields an lcm of 0 without throwing. @test7 by 3 returns a truncated quotient of 2 and a remainder of 1, preserving the dividend sign on the remainder. @test-7 by 3 returns a truncated quotient of -2 and a remainder of -1, demonstrating round-toward-zero behavior. @test-7 by 3 reports a floored quotient of -3 with a modulus of 2 (modulus shares the divisor’s sign), contrasting the truncated result. @test7 by -3 reports a floored quotient of -3 with a modulus of -2, preserving dividend = divisor * quotient + modulus. @test/**
* Returns the greatest common divisor of two integers as a non-negative number.
*/
export function greatestCommonDivisor(a: number, b: number): number;
/**
* Returns the least common multiple of two integers as a non-negative number.
*/
export function leastCommonMultiple(a: number, b: number): number;
/**
* Computes truncated integer division (quotient toward zero) and associated remainder.
*/
export function truncatedDivision(dividend: number, divisor: number): { quotient: number; remainder: number };
/**
* Computes floored integer division (quotient toward negative infinity) and associated modulus.
*/
export function flooredDivision(dividend: number, divisor: number): { quotient: number; modulus: number };Functional utilities used for number theory helpers and integer division semantics. @satisfied-by