summaryrefslogtreecommitdiff
path: root/factors
diff options
context:
space:
mode:
authorAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-09-05 13:14:37 -0500
committerAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-09-05 13:14:37 -0500
commit14de0ee99e7f81a41a8bca80c3c6af29e84c3062 (patch)
treede666b19e131c31b924efadcf6b2777510ca32d0 /factors
parent55981e7bb325f5dc84384e90c76a7f29005d62f8 (diff)
Alter backing values of enum types
The backing constants of NumberType and TotativeType have been changed so that they can be compared (based on how desirable they are, more desirable categories are given higher values), and so that I can add new values in between without changing the constants.
Diffstat (limited to 'factors')
-rw-r--r--factors/digit_map.go14
-rw-r--r--factors/type.go10
2 files changed, 12 insertions, 12 deletions
diff --git a/factors/digit_map.go b/factors/digit_map.go
index db562db..83606e9 100644
--- a/factors/digit_map.go
+++ b/factors/digit_map.go
@@ -7,28 +7,28 @@ type DigitType struct {
totativeType TotativeType
}
-type TotativeType uint8
+type TotativeType byte
const (
// This number does not have any totative factors
- Regular TotativeType = iota
+ Regular TotativeType = 0xC0
// This number's totative part is divisible by (r - 1)
// - this gives it the simplest possible decimal expansion
// for a non-regular (1 digit repeating) and a simple divisibility
// test (sum digits, like 3 or 9 in decimal)
- Omega
+ Omega TotativeType = 0xA0
// This number's totative part is divisible by (r + 1)
// - this makes it slightly more complicated than omega
- Alpha
+ Alpha TotativeType = 0x80
// This number's totative part is divisible by (r^2 - 1)
// but not (r + 1) or (r - 1)
// - these totatives straddle the line between simple and complex
- Pseudoneighbour
+ Pseudoneighbour TotativeType = 0x60
// This number's totative part is not divisible by (r^2 - 1)
// - it will not be nice to work with
- Opaque
+ Opaque TotativeType = 0x40
// This number is zero, and doesn't have a true totative type.
- Zero
+ Zero TotativeType = 0x00
)
// Zero and one will always have these types.
diff --git a/factors/type.go b/factors/type.go
index 39aab9b..4b58a1d 100644
--- a/factors/type.go
+++ b/factors/type.go
@@ -20,19 +20,19 @@ const (
// 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 = 0x84
+ ColossallyAbundant NumberType = 0xC0
// A number whose factor score is higher than any smaller number.
// All superabundant numbers have ordered exponents.
- Superabundant NumberType = 0x83
+ Superabundant NumberType = 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 = 0x82
+ OrderedExponent NumberType = 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 = 0x81
+ Practical NumberType = 0x60
// None of the above types
- NotPractical NumberType = 0x80
+ NotPractical NumberType = 0x40
)
func Type(n uint32) NumberType {