diff options
Diffstat (limited to 'factor_info.go')
| -rw-r--r-- | factor_info.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/factor_info.go b/factor_info.go index 638e333..ae3b60a 100644 --- a/factor_info.go +++ b/factor_info.go @@ -68,6 +68,8 @@ type factorInfo struct { // The memorization for the product of prime powers // is less than the memorization of worst part of the product. PrimeRegularComplexities map[uint]float64 + // If true, the above field is the log2 of its true value. + LogRegularComplexities bool } const ( @@ -114,11 +116,17 @@ func getFactorInfo(a args) *factorInfo { totativeRatio := float64(totativeCount) / float64(radix) var prcs = factors.PrimeRegularComplexities(radix) + if a.LogRegularComplexities { + for regular := range prcs { + prcs[regular] = math.Log2(prcs[regular]) + } + } return &factorInfo{radix, factors.PrimeFactorize(radix), r_factors, factors.Score(radix), totativeCount, totativeRatio, totativeDigits, factors.BasicRank(radix), factors.Type(radix), - mtc_ptr, math.Log2(float64(radix)), digitMap, prcs} + mtc_ptr, math.Log2(float64(radix)), digitMap, prcs, + a.LogRegularComplexities} } func (fi *factorInfo) writeTo(w io.Writer) { @@ -148,7 +156,11 @@ func (fi *factorInfo) writeTo(w io.Writer) { fmt.Fprintf(w, "Base-2 Logarithm: %.3f\n", fi.Log2) fmt.Fprintf(w, "Number Length: %.4f×Decimal\n", 1/math.Log10(float64(fi.Radix))) - fmt.Fprint(w, "Prime Regular Complexities: ") + if fi.LogRegularComplexities { + fmt.Fprint(w, "log2(Prime Regular Complexities): ") + } else { + fmt.Fprint(w, "Prime Regular Complexities: ") + } writePRCMap(w, fi.PrimeRegularComplexities) fmt.Fprintln(w) if len(fi.DigitMap) > 0 { |
