summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-09-05 11:37:00 -0500
committerAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-09-05 12:58:22 -0500
commit8bb4a3b74712b16954b93ae18f4d3dcd5bea063b (patch)
treed9b85265e2b8b052d54b4e185b1dd590779a76fa
parentebdc5107b8b2bd69a65a34a6276fc64b84d210ec (diff)
Add lower bound estimate for massive MTCs
This can easily be estimated from existing information, so it's useful to have, even in the compact view. This estimate is more accurate (narrows the range down further) the higher the radix's totative ratio. It also should be closer to the actual value than the upper bound.
-rw-r--r--factor_info.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/factor_info.go b/factor_info.go
index c243048..0d0bd40 100644
--- a/factor_info.go
+++ b/factor_info.go
@@ -98,8 +98,11 @@ func (fi *FactorInfo) WriteTo(w io.Writer) {
if fi.MTC != nil {
fmt.Fprintln(w, "Multiplication Table Complexity:", *fi.MTC)
} else {
- fmt.Fprintf(w, "Multiplication Table Complexity ≤ %.4g\n",
- float32(fi.Radix)*float32(fi.Radix-2))
+ low_mtc_est := float64(fi.Radix)*float64(fi.Totient-2)
+ high_mtc_est := float64(fi.Radix)*float64(fi.Radix-2)
+ fmt.Fprintf(w,
+ "Multiplication Table Complexity is between %.6g and %.6g.\n",
+ low_mtc_est, high_mtc_est)
}
fmt.Fprintf(w, "Natural Logarithm: %.3f\n", fi.Ln)
if len(fi.DigitMap) > 0 {
@@ -116,7 +119,9 @@ func (fi *FactorInfo) WriteToCompact(w io.Writer) {
if fi.MTC != nil {
fmt.Fprintf(w, "MTC: %d | ", *fi.MTC)
} else {
- fmt.Fprintf(w, "MTC ≤ %.3g | ", float32(fi.Radix)*float32(fi.Radix-2))
+ low_mtc_est := float32(fi.Radix)*float32(fi.Totient-2)
+ high_mtc_est := float32(fi.Radix)*float32(fi.Radix-2)
+ fmt.Fprintf(w, "%.4g ≤ MTC ≤ %.4g | ", low_mtc_est, high_mtc_est)
}
fmt.Fprintf(w, "Ln: %.2f", fi.Ln)
fmt.Fprintln(w)