Skip to content

Conversation

@bradcray
Copy link
Member

@bradcray bradcray commented Oct 31, 2025

This adds an lcm() routine to the math module using an implementation that leans heavily on the existing gcd() routine. It also adds a test that checks the LCM values of the integers 1..20 x 1..20 using each of the int/uint sizes, which shows the wraparound that takes place for 8-bit int/uint.

Resolves #18999.

TODO:

  • in order for this to be merged, it either needs to be marked unstable or put into the preview edition; while the former is tempting due to its simplicity, it will need to be moved into a preview edition before being stabilized anyway, so it also puts off the inevitable creting more work down the line.

This adds an lcm() routine to the math module using an implementation
that leans heavily on the existing gcd() routine.  It also adds a
test that checks the LCM values of the integers 1..20 x 1..20 using
each of the int/uint sizes.

---
Signed-off-by: Brad Chamberlain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Math module - should we provide lcm as well? Or just point gcd users to BigInteger if they want it?

1 participant