summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-09-07 17:39:15 -0500
committerAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-09-07 19:33:54 -0500
commitd6bb5352f93f2260f4a37ccd7c71bd08c4d03340 (patch)
treec6a340e891a518ab48ec3328e32548fb4f91e37a
parent3cfb1fdcbe83c1ee4adf8e370f0922ca41c472c6 (diff)
Add regular util. score, replace in compact view
The RUS is like the factor utility score, but for regulars (numbers divisible by any power of the radix) instead of factors (numbers divisible by the radix). It estimates the utility of fractions that terminate but with more than one digit, like 4, 8 and 20 in decimal. It is also (by coincidence) the reciprocoal of the totative ratio. I am replacing it in the compact view because it is more useful, for two reasons: - It can be meaningfully compared with the factor utility score. By subtracting RUS-FUS, you can find the utility of non-factor regulars. This score can give a hint about how often these fractions will be used in a radix. It also can tell you how much benefit you can get from adding another copy of a radix's prime factors. For example, senary (RUS-FUS=1.0) can gain a lot from adding another 2 or 3, while octal (RUS-FUS=0.125) probably won't (in terms of factors at least, the benefits for computers are separate to this) - Because of the way they are calculated, the RUS is far more likely to be a round/terminating decimal than the totative ratio. This means that taking the reciprocoal to get the benefits of the other number is far easier with the RUS than the totative ratio.
-rw-r--r--factor_info.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/factor_info.go b/factor_info.go
index bcfc3b1..767a9bf 100644
--- a/factor_info.go
+++ b/factor_info.go
@@ -100,7 +100,10 @@ func getFactorInfo(a args) *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, "Factors:", fi.Factors)
+ fmt.Fprintf(w, "Factor Utility Score: %.4f\n", fi.Score)
+ fmt.Fprintf(w, "Regular Utility Score: %.4f\n",
+ float64(fi.Radix) / float64(fi.Totient))
fmt.Fprintln(w, "2345 Rank:", fi.BasicRank)
if fi.TotativeDigits != nil {
fmt.Fprintf(w, "Totative Digits: %v (%.3f%%)\n",
@@ -126,8 +129,8 @@ func (fi *factorInfo) writeTo(w io.Writer) {
}
func (fi *factorInfo) writeToCompact(w io.Writer) {
- fmt.Fprintf(w, "%d = %s | σ(r)/r: %.2f | φ(r)/r: %.3f\n",
- fi.Radix, fi.PrimeFactorization, fi.Score, fi.TotativeRatio)
+ fmt.Fprintf(w, "%d = %s | σ(r)/r: %.2f | r/φ(r): %.2f\n",
+ fi.Radix, fi.PrimeFactorization, fi.Score, 1 / fi.TotativeRatio)
fmt.Fprintf(w, "%s | ", typeAbbrev(fi.Type))
if fi.MTC != nil {
fmt.Fprintf(w, "MTC: %d | ", *fi.MTC)