summaryrefslogtreecommitdiff
path: root/factors/regular_complexity.go
diff options
context:
space:
mode:
Diffstat (limited to 'factors/regular_complexity.go')
-rw-r--r--factors/regular_complexity.go16
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
+}