diff options
| author | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2023-08-30 13:53:53 -0500 |
|---|---|---|
| committer | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2023-08-30 14:05:09 -0500 |
| commit | 778220b2e3ce662e733727fb9a560fcfe85c19eb (patch) | |
| tree | 38d18d3db70943b42a62f1f786777022e954bd87 /factors/mtc.go | |
| parent | b9164fb5b41136a63391f5675a848ec4a7711cb6 (diff) | |
Add digit map calculation
This is not in the output yet, but it will be soon - printing it is
another task since I want colours in my output.
Diffstat (limited to 'factors/mtc.go')
| -rw-r--r-- | factors/mtc.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/factors/mtc.go b/factors/mtc.go index 522a35c..655124c 100644 --- a/factors/mtc.go +++ b/factors/mtc.go @@ -5,7 +5,7 @@ package factors // multiplication table. func MTC(n uint64) uint64 { mtc := uint64(0) - for i := uint64(2); i <= n - 2; i++ { + for i := uint64(2); i <= n-2; i++ { mtc += n / gcd(i, n) } return mtc @@ -13,7 +13,7 @@ func MTC(n uint64) uint64 { func gcd(a, b uint64) uint64 { for b > 0 { - a, b = b, a % b + a, b = b, a%b } return a } |
