From 5978972b06fb5e29723e4bab61bdfee74b42b126 Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Mon, 4 Sep 2023 18:07:09 -0500 Subject: Rearrange order of components in output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- factor_info.go | 14 ++++++++------ 1 file 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) -- cgit v1.2.3