Skip to content

Instantly share code, notes, and snippets.

@halka9000stg
Created February 4, 2024 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halka9000stg/65277559567ff25216f2da855465ffd6 to your computer and use it in GitHub Desktop.
Save halka9000stg/65277559567ff25216f2da855465ffd6 to your computer and use it in GitHub Desktop.
Demo for LCM Simple Implementation
void main(){
print((5).lcm(2));
print((4).lcm(3));
}
extension LCM on int {
int lcm(int other) => (this * other) ~/ this.gcd(other);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment