summaryrefslogtreecommitdiff
path: root/factor_info.go
diff options
context:
space:
mode:
authorAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-09-04 18:07:09 -0500
committerAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-09-04 18:54:07 -0500
commit5978972b06fb5e29723e4bab61bdfee74b42b126 (patch)
treefd76221a238a2e6772c23b6525cfeb73376b6711 /factor_info.go
parent934d4f8c74928d946adfca5c9a22fecd7ea47c92 (diff)
Rearrange order of components in output
In general, components go in the order Factors → Totatives → Size. 2345 Score was moved to fit this order, since it concerns both factors (2-5) and totatives (5). The compact view was rearranged to have a consistent order with the normal view. Also I added the MTC estimate for very large radices into the compact view, because it can be there.
Diffstat (limited to 'factor_info.go')
-rw-r--r--factor_info.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/factor_info.go b/factor_info.go
index 6a19173..b6a4a3d 100644
--- a/factor_info.go
+++ b/factor_info.go
@@ -81,9 +81,9 @@ func GetFactorInfo(radix uint) *FactorInfo {
func (fi *FactorInfo) WriteTo(w io.Writer) {
fmt.Fprintln(w, fi.Radix, "=", fi.PrimeFactorization)
fmt.Fprintf(w, "Factors: %v (Score: %.4f)\n", fi.Factors, fi.Score)
+ fmt.Fprintln(w, "2345 Rank:", fi.BasicRank)
fmt.Fprintf(w, "Totative Digit Count: %d (%.3f%%)\n",
fi.TotativeCount, fi.TotativeRatio * 100.0)
- fmt.Fprintln(w, "2345 Rank:", fi.BasicRank)
if fi.Type != nil {
writeTypeMessage(w, *fi.Type)
}
@@ -102,13 +102,15 @@ func (fi *FactorInfo) WriteTo(w io.Writer) {
func (fi *FactorInfo) WriteToCompact(w io.Writer) {
fmt.Fprintf(w, "%d = %s | σ(n)/n: %.2f | τ(n)/n: %.3f\n",
fi.Radix, fi.PrimeFactorization, fi.Score, fi.TotativeRatio)
- fmt.Fprintf(w, "Ln: %.2f", fi.Ln)
- if fi.MTC != nil {
- fmt.Fprintf(w, " | MTC: %d", *fi.MTC)
- }
if fi.Type != nil {
- fmt.Fprintf(w, " | %s", typeAbbrev(*fi.Type))
+ fmt.Fprintf(w, "%s | ", typeAbbrev(*fi.Type))
}
+ if fi.MTC != nil {
+ fmt.Fprintf(w, "MTC: %d | ", *fi.MTC)
+ } else {
+ fmt.Fprintf(w, "MTC ≤ %.3g | ", float32(fi.Radix)*float32(fi.Radix-2))
+ }
+ fmt.Fprintf(w, "Ln: %.2f", fi.Ln)
fmt.Fprintln(w)
if len(fi.DigitMap) > 0 {
writeDigitMapCompact(w, fi.DigitMap)