apple / apple/swift-numerics

Variadic GCD and LCM

Open
#275 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
1.9k
Forks
181
Avg merge
2d 5h
Merged PRs (30d)
6

Description

While #10 exists, I will use this as a separate tracker for these two algorithms and their variadic structure. Also inspired by Advent of Code 2023 Day 8 pt 2 which used the LCM of a collection of numbers.

The existing `gcd` can be made easily to take a variadic amount of values, along with some checks. `lcm` can also be implemented using the `gcd` method, also variadic.

~~It does allow 0 and 1 parameters, which are easy cases to account for. Just seems funky that one can put `gcd()` and `lcm()` 🤷, but these have sensible mathematical conventions.~~

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing gcd implementation and any related tests in the Swift Numerics repository. Determine the intended variadic signatures and behavior for zero, one, and multiple values from the issue's mathematical conventions. Done means variadic GCD and LCM are implemented through the existing GCD logic and their edge cases are covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.