diff options
Diffstat (limited to 'factor_info.go')
| -rw-r--r-- | factor_info.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/factor_info.go b/factor_info.go index ce014ed..93cb9d2 100644 --- a/factor_info.go +++ b/factor_info.go @@ -20,6 +20,9 @@ type FactorInfo struct { Factors []uint // An estimate of the utility of the radix's factors. 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 // The fraction of digits that are totatives (numbers that share no // factors with the radix - they are the worst kind of digits) TotativeRatio float64 @@ -70,15 +73,16 @@ func GetFactorInfo(radix uint) *FactorInfo { } return &FactorInfo{radix, factors.PrimeFactorize(radix), - r_factors, factors.Score(radix), factors.TotativeRatio(radix), - factors.BasicRank(radix), r_type_ptr, mtc_ptr, - math.Log(float64(radix)), digitMap} + r_factors, factors.Score(radix), factors.TotativeCount(radix), + factors.TotativeRatio(radix), factors.BasicRank(radix), + r_type_ptr, mtc_ptr, math.Log(float64(radix)), digitMap} } 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.Fprintf(w, "Totative Ratio: %.3f%%\n", fi.TotativeRatio * 100.0) + 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) |
