diff options
| author | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2025-09-22 15:56:30 -0500 |
|---|---|---|
| committer | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2025-09-22 15:56:30 -0500 |
| commit | ac766f4f6ab9db683e29b093bbc48cfe3b27b2b7 (patch) | |
| tree | e104bcc4a2fb2fa419a61d11685b13de9cf9e29e /factors/regular_complexity.go | |
| parent | 29472fc13c4c151fbd432a5a271ff7d0b0af971f (diff) | |
Show regular complexity of prime factors
This metric shows how many combinations you'll need to memorize prime
powers, and how big the numbers are in complementary multiplication.
The YouTube video "the best way to count" inspired me to think I need
a metric to handle both size and factors, but the specific metric is
entirely original (or at least independently discovered).
Diffstat (limited to 'factors/regular_complexity.go')
| -rw-r--r-- | factors/regular_complexity.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/factors/regular_complexity.go b/factors/regular_complexity.go new file mode 100644 index 0000000..763bcd7 --- /dev/null +++ b/factors/regular_complexity.go @@ -0,0 +1,16 @@ +package factors + +import ( + "math" +) + +func PrimeRegularComplexities(radix uint) map[uint]float64 { + var factorization = PrimeFactorize(radix) + var complexities = make(map[uint]float64, len(factorization.exponents)) + for p, e := range factorization.exponents { + var part = float64(uintpow(p, e)) + var complexity = math.Pow(float64(radix)/part, 1/float64(e)) + complexities[p] = complexity + } + return complexities +} |
