From 7fe152e1de2ce0ff9716d54bd03ec090a601824a Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Mon, 9 Oct 2023 16:25:09 -0500 Subject: factors: Give Type proper name & zero value --- factors/type.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'factors/type.go') diff --git a/factors/type.go b/factors/type.go index 91eb94e..919baef 100644 --- a/factors/type.go +++ b/factors/type.go @@ -42,33 +42,33 @@ var superabundantNums = [...]uint64{ } // A classification of numbers, based on how many factors they have. -// Each type is a subset of the next (except [Practical] and [NotPractical]), +// Each type is a subset of the next +// (except [Practical] and [NoneOfTheAbove]), // so a number is only counted as its most exclusive type. -// The zero value of this type is invalid. -type NumberType byte +type CompositenessType byte const ( // A number whose factor score is higher than any other, // if you adjust for size by dividing by some power of the number // (different powers yield different best numbers). // All colossally abundant numbers are also superabundant. - ColossallyAbundant NumberType = 0xC0 + ColossallyAbundant CompositenessType = 0xC0 // A number whose factor score is higher than any smaller number. // All superabundant numbers have ordered exponents. - Superabundant NumberType = 0xA0 + Superabundant CompositenessType = 0xA0 // A number whose prime factorization exponents stay the same or decrease // as you go from smaller to larger primes. // All of these numbers are also practical. - OrderedExponent NumberType = 0x80 + OrderedExponent CompositenessType = 0x80 // A number whose factors can sum to any smaller number without duplication. // All practical numbers besides 1 and 2 are divisible by 4 or 6. - Practical NumberType = 0x60 - // None of the above types - NotPractical NumberType = 0x40 + Practical CompositenessType = 0x60 + // None of the above types. This is the zero value of CompositenessType. + None CompositenessType = 0x00 ) -// Type determines the [NumberType] of a number. -func Type(n uint) NumberType { +// Type determines the [CompositenessType] of a number. +func Type(n uint) CompositenessType { if slices.Contains(colossallyAbundantNums[:], uint64(n)) { return ColossallyAbundant } else if slices.Contains(superabundantNums[:], uint64(n)) { @@ -78,7 +78,7 @@ func Type(n uint) NumberType { } else if practical(n) { return Practical } else { - return NotPractical + return None } } -- cgit v1.2.3