diff options
Diffstat (limited to 'factor_info.go')
| -rw-r--r-- | factor_info.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/factor_info.go b/factor_info.go index f908b9b..c243048 100644 --- a/factor_info.go +++ b/factor_info.go @@ -22,7 +22,7 @@ type FactorInfo struct { Score float64 // The number of digits that are totatives (numbers that share no // factors with the radix - they are the worst kind of digits) - TotativeCount uint + Totient uint // The fraction of digits that are totatives (numbers that share no // factors with the radix - they are the worst kind of digits) TotativeRatio float64 @@ -77,10 +77,13 @@ func GetFactorInfo(radix uint, fullMap bool) *FactorInfo { digitMap = []factors.DigitType{} } + totativeCount := factors.Totient(radix) + totativeRatio := float64(totativeCount) / float64(radix) + return &FactorInfo{radix, factors.PrimeFactorize(radix), - r_factors, factors.Score(radix), factors.TotativeCount(radix), - factors.TotativeRatio(radix), factors.BasicRank(radix), - r_type_ptr, mtc_ptr, math.Log(float64(radix)), digitMap} + r_factors, factors.Score(radix), totativeCount, totativeRatio, + factors.BasicRank(radix), r_type_ptr, mtc_ptr, + math.Log(float64(radix)), digitMap} } func (fi *FactorInfo) WriteTo(w io.Writer) { @@ -88,7 +91,7 @@ func (fi *FactorInfo) WriteTo(w io.Writer) { 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) + fi.Totient, fi.TotativeRatio * 100.0) if fi.Type != nil { writeTypeMessage(w, *fi.Type) } @@ -105,7 +108,7 @@ 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", + fmt.Fprintf(w, "%d = %s | σ(n)/n: %.2f | φ(n)/n: %.3f\n", fi.Radix, fi.PrimeFactorization, fi.Score, fi.TotativeRatio) if fi.Type != nil { fmt.Fprintf(w, "%s | ", typeAbbrev(*fi.Type)) |
