From 778220b2e3ce662e733727fb9a560fcfe85c19eb Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Wed, 30 Aug 2023 13:53:53 -0500 Subject: 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. --- factors/mtc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'factors/mtc.go') 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 } -- cgit v1.2.3