Skip to content

Add lcm(a, b) to the math module #47

Closed

Description

@kirkmarple-clockgrove

Goal

Callers of the math module can compute the least common multiple of two integers with lcm(a, b) exported from src/math.mjs, alongside the existing functions. The README tells a reader the function exists, what it returns and when it throws.

Acceptance

  • src/math.mjs exports lcm(a, b), which returns the least common multiple of the integers a and b as a non-negative number; the sign of either argument does not matter, and it returns 0 when either argument is 0. It throws a RangeError when a or b is not an integer. The existing exports are unchanged.
  • A test under test/ imports lcm from ../src/math.mjs and checks at least lcm(4, 6) === 12, lcm(-4, 6) === 12, lcm(0, 5) === 0, lcm(7, 1) === 7, and that lcm(2.5, 4) throws a RangeError.
  • npm test passes, the existing tests included.
  • README.md documents lcm(a, b) in one short section or list entry, in the same style as the other functions, with a usage example and the RangeError case.

Context

No new dependencies. Leave package.json, the CI workflow and the Pendulum workflow unchanged.

Activity

  1. clockgrove-pendulum commented on Nov 18, 2026

    @clockgrove-pendulum
    Contributor

    ✅ Work delivered · PR #48 · 1 min · $0.32
    3:34 PM – 3:35 PM PST · billed to your API key

    Time Step Took Cost
    3:34 PM Set up — —
    3:34 PM Built the change · Opus 5.5 37 s $0.32
    3:35 PM Handed CI to the review · CI on cb0f274 still running — —
    Total 1 min $0.32
    Run details
    • Run: 44421750471 on GitHub Actions · agent Claude Code · chosen by pendulum:harness:claude
    • Models: worker Opus 5.5 · sub-agents Sonnet 5.5 · reviewer Fable 5.2
    • Session: new (resume policy is fresh)
    • Cost notes: These dollars are billed to your API key or AI Gateway key.
    • In Took, — means no recorded start and end; in Cost, — means no AI ran in that step or it cost nothing, and AI judge calls are counted in their own row. Steps can overlap, so the Took column does not add up to the total; the full log below is in time order.

    Full log

    Pendulum work run 44421750471 · PR #48: started 3:34 PM PST, 1 min at the last line.

    • 3:34 PM PST re-entry: fresh (resume policy is fresh)
    • 3:34 PM PST harness claude (claude-opus-5-5) attempt 1
    • 3:35 PM PST validation: required checks test on cb0f274 run while the review starts; handed to the review stage
    • 3:35 PM PST exit: delivered; usd 0.319521
  2. clockgrove-pendulum commented on Nov 18, 2026

    @clockgrove-pendulum
    Contributor

    Plan for #47: Add lcm(a, b) to the math module

    Goal

    Export lcm(a, b) from src/math.mjs, returning the non-negative least common multiple of two integers (0 when either is 0, sign-insensitive) and throwing a RangeError for non-integer arguments. Test it under test/ and document it in README.md in the style of the existing entries, without touching any existing export, package.json or workflows.

    Checklist

    1. Add lcm(a, b) to the math module and its test (acceptance entries 1, 2, 3).
      Files: src/math.mjs, test/math.test.mjs
    2. Document lcm(a, b) in the README with a usage example and the RangeError case (acceptance entry 4).
      Files: README.md
    3. Run npm test over the whole tree (acceptance entry 3).

    Assumptions

    1. lcm is computed as |a / gcd(a, b) * b| using the existing gcd export; dividing first keeps intermediate values small.
    2. lcm(0, 0) returns 0 (the issue says 0 when either argument is 0), and the result is never -0.
    3. Non-integer means !Number.isInteger(x), so NaN, Infinity and non-number values also throw RangeError, matching factorial's check.
    4. The test is added to the existing test/math.test.mjs, which already imports from ../src/math.mjs, rather than a new file.
    5. The items are small enough that the worker session wrote them directly instead of spawning implementer sub-agents.

    Design note

    The repository has no design checklist.

  3. added
    pendulum:in-reviewPendulum PR open, reviewer pass pending or done
    and removed
    pendulum:runningPendulum worker running (fallback for the Project card)
    on Nov 18, 2026
  4. clockgrove-pendulum commented on Nov 18, 2026

    @clockgrove-pendulum
    Contributor

    ✅ Review delivered · PR #48 · 44 s · $0.20
    3:35 PM – 3:36 PM PST · billed to your API key

    Time Step Took Cost
    3:35 PM Set up — —
    3:35 PM Waited for CI · passed on cb0f274 1 s —
    3:35 PM Reviewed the change · Fable 5.2 11 s $0.20
    Total 44 s $0.20
    Run details
    • Run: 44422036434 on GitHub Actions · agent Claude Code · chosen by pendulum:harness:claude
    • Models: worker Opus 5.5 · sub-agents Sonnet 5.5 · reviewer Fable 5.2
    • Session: new (resume policy is fresh)
    • Cost notes: These dollars are billed to your API key or AI Gateway key.
    • In Took, — means no recorded start and end; in Cost, — means no AI ran in that step or it cost nothing, and AI judge calls are counted in their own row. Steps can overlap, so the Took column does not add up to the total; the full log below is in time order.

    Full log

    Pendulum review run 44422036434 · PR #48: started 3:35 PM PST, 1 min at the last line.

    • 3:35 PM PST re-entry: fresh (resume policy is fresh)
    • 3:35 PM PST pre-review-validation pass 1 (required checks)
    • 3:35 PM PST waiting for required checks (test) on cb0f274
    • 3:35 PM PST reviewer claude-fable-5-2
    • 3:36 PM PST exit: delivered; usd 0.200985
  5. clockgrove-pendulum commented on Nov 18, 2026

    @clockgrove-pendulum
    Contributor

    ✅ Merged in 3 min 50 s · $0.52

    Issue #47 → PR #48 · merged through your merge queue at 3:37 PM PST · billed to your API key

    You wrote the issue and added the label. Pendulum planned the work, opened PR #48 (1 commit, +29 −1 across 3 files), got 1 CI check green, had the change reviewed (no findings), and it merged through your merge queue.

    Timeline (PST)

    %%{init: {"theme":"base","themeVariables":{"fontSize":"16px","taskBkgColor":"#c9822e","taskBorderColor":"#7a4a24","activeTaskBkgColor":"#c9822e","activeTaskBorderColor":"#7a4a24","taskTextColor":"#1f1206","taskTextDarkColor":"#1f1206","taskTextLightColor":"#1f1206","taskTextOutsideColor":"#b06f22","taskTextClickableColor":"#b06f22","sectionBkgColor":"rgba(201,130,46,0.12)","altSectionBkgColor":"rgba(201,130,46,0.04)","sectionBkgColor2":"rgba(201,130,46,0.12)","titleColor":"#b06f22","textColor":"#b06f22","gridColor":"#8b949e","excludeBkgColor":"transparent","doneTaskBkgColor":"#8b949e","doneTaskBorderColor":"#6e7781","critBkgColor":"#b3402a","critBorderColor":"#7a2a1c"},"themeCSS":"text.taskTextOutsideRight, text.taskTextOutsideLeft { fill: #b06f22 !important; } .grid .tick line { stroke: #8b949e; }","gantt":{"useWidth":440,"barHeight":24,"barGap":6,"fontSize":15,"sectionFontSize":15,"leftPadding":80}}}%%
    gantt
        dateFormat YYYY-MM-DDTHH:mm:ss
        axisFormat %H:%M
        tickInterval 1minute
        todayMarker off
        section Build
        59s :active, 2026-11-18T15:34:26, 2026-11-18T15:35:25
        section Review
        37s :active, 2026-11-18T15:35:50, 2026-11-18T15:36:27
        section Queue
        51s :active, 2026-11-18T15:36:24, 2026-11-18T15:37:15
    
    Loading
    Time Stage Took Cost
    3:34 PM Plan + build · Opus 5.5 59 s $0.32
    3:35 PM Review · Fable 5.2 37 s $0.20
    3:36 PM Merge queue · your CI 51 s —
    Total 3 min 50 s $0.52

    CI minutes are not included.

    Run details
    • Cost basis: These dollars are billed to your API key or AI Gateway key.
    • Where figures come from: times from the issue, the PR and each stage's own record; dollars from each stage's own record. Nothing is estimated.
    • — in Took means no time was recorded for that row; in Cost, that no AI dollars were (a stage that ran no AI, the merge queue, time on hold).
    • Pendulum 0.10.6+756e7955eda4

    Run log (PST)

    • 3:33:25 PM labelled pendulum:objective: the clock starts
    • 3:34:26 PM plan + build stage started (claude-opus-5-5)
    • 3:35:13 PM PR #47: Add lcm(a, b) to the math module #48 opened
    • 3:35:25 PM plan + build stage's last line: $0.32
    • 3:35:50 PM review stage started (claude-fable-5-2)
    • 3:36:10 PM last review: 1 review in all, no findings
    • 3:36:24 PM added to the merge queue
    • 3:36:27 PM review stage's last line: $0.20
    • 3:37:15 PM PR #47: Add lcm(a, b) to the math module #48 merged, 1 CI check green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions