// 数学工具模块（依赖 lib/core）

import { add, mul } from "../lib/core";

export function square(x: number): number {
    return mul(x, x);
}

export function sumOfSquares(a: number, b: number): number {
    return add(square(a), square(b));
}

export function factorial(n: number): number {
    if (n <= 1) {
        return 1;
    }
    return mul(n, factorial(n - 1));
}
