Skip to content

Commit

Permalink
a bit more flint integer stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
d-torrance committed Nov 27, 2024
1 parent b83fcb4 commit 1babb49
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions M2/Macaulay2/packages/FlintIntegers.m2
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ gcd(FlintInteger, FlintInteger) := (m, n) -> (
r)
gcd(FlintInteger, ZZ) := (m, n) -> gcd(m, flintInteger n)
gcd(ZZ, FlintInteger) := (m, n) -> gcd(flintInteger m, n)
gcd FlintInteger := identity

fmpzLcm = foreignFunction("fmpz_lcm", void, {fmpzT, fmpzT, fmpzT})
lcm(FlintInteger, FlintInteger) := (m, n) -> (
r := flintInteger 0;
fmpzLcm(r, m, n);
r)
lcm(FlintInteger, ZZ) := (m, n) -> lcm(m, flintInteger n)
lcm(ZZ, FlintInteger) := (m, n) -> lcm(flintInteger m, n)
lcm FlintInteger := identity

fmpzEulerPhi = foreignFunction("fmpz_euler_phi", void, {fmpzT, fmpzT})
eulerPhi = method()
Expand Down Expand Up @@ -257,6 +267,12 @@ assert Equation(gcd(flintInteger 6, flintInteger 9), 3)
assert Equation(gcd(flintInteger 6, 9), 3)
assert Equation(gcd(6, flintInteger 9), 3)
assert Equation(gcd(flintInteger 6, flintInteger 9, flintInteger 12), 3)
assert Equation(gcd flintInteger 3, 3)
assert Equation(lcm(flintInteger 6, flintInteger 9), 18)
assert Equation(lcm(flintInteger 6, 9), 18)
assert Equation(lcm(6, flintInteger 9), 18)
assert Equation(lcm(flintInteger 6, flintInteger 9, flintInteger 12), 36)
assert Equation(lcm flintInteger 3, 3)
///

end
Expand Down

0 comments on commit 1babb49

Please sign in to comment.