summaryrefslogtreecommitdiff
path: root/factors/type.go
diff options
context:
space:
mode:
authorAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-10-09 16:25:09 -0500
committerAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-10-09 16:25:09 -0500
commit7fe152e1de2ce0ff9716d54bd03ec090a601824a (patch)
tree0135b63f92f10c055f502ab91724ad8d08d6ed2e /factors/type.go
parentc50ece109cdb29ab5d3fa7444040b546da7e360c (diff)
factors: Give Type proper name & zero value
Diffstat (limited to 'factors/type.go')
-rw-r--r--factors/type.go24
1 files changed, 12 insertions, 12 deletions
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
}
}