summaryrefslogtreecommitdiff
path: root/factors/type.go
diff options
context:
space:
mode:
Diffstat (limited to 'factors/type.go')
-rw-r--r--factors/type.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/factors/type.go b/factors/type.go
index 919baef..3e116af 100644
--- a/factors/type.go
+++ b/factors/type.go
@@ -1,7 +1,5 @@
package factors
-import "slices"
-
// The set of all colossaly abundant numbers that are small enough
// to be stored in a uint64.
// The first 15 are also the first 15 superior highly composites.
@@ -69,9 +67,9 @@ const (
// Type determines the [CompositenessType] of a number.
func Type(n uint) CompositenessType {
- if slices.Contains(colossallyAbundantNums[:], uint64(n)) {
+ if contains(colossallyAbundantNums[:], uint64(n)) {
return ColossallyAbundant
- } else if slices.Contains(superabundantNums[:], uint64(n)) {
+ } else if contains(superabundantNums[:], uint64(n)) {
return Superabundant
} else if exponentsOrdered(n) {
return OrderedExponent
@@ -99,7 +97,7 @@ func exponentsOrdered(n uint) bool {
}
pf := PrimeFactorize(n)
- maxPrime := slices.Max(pf.Primes())
+ maxPrime := maxUints(pf.Primes())
for prime, prevPrime := uint(3), uint(2); prime <= maxPrime; {
if pf.Exponent(prime) > pf.Exponent(prevPrime) {
@@ -122,8 +120,7 @@ func practical(n uint) bool {
}
pf := PrimeFactorize(uint(n))
- primes := pf.Primes()
- slices.Sort(primes)
+ primes := sortUints(pf.Primes())
// algorithm from Wikipedia
for i := 0; i < pf.Size()-1; i++ {