From 29472fc13c4c151fbd432a5a271ff7d0b0af971f Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Wed, 20 Nov 2024 22:08:38 -0500 Subject: Add reciprocoal logarithm to non-compact view Although I have the regular logarithm, its reciprocoal is useful to determine the length of numbers in a certain radix. Like with the totative ratio (where both it and its reciprocoal are useful), I showed both in the regular view and only one in the compact view. --- README.org | 2 ++ factor_info.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.org b/README.org index 09fab4a..4544e13 100644 --- a/README.org +++ b/README.org @@ -84,6 +84,8 @@ Some radices fall into certain classes that indicate they have many useful facto The MTC is an estimate of how difficult it is to learn a radix's multiplication table. Every row except 0, 1 and the last one (which have their own patterns) is assigned a difficulty equal to the length of the pattern in its last digit, and these difficulties are summed to get the overall MTC. ** Base-2 Logarithm The radix's base-2 logarithm indicates its information density - how much information it can fit into a digit. Radices with higher logarithms will be able to count higher with fewer digits, and approximations will be more accurate for the same number of decimal places. Specifically, one digit in radix n is equivalent to log_2(n) bits (base-2 digits). + +The reciprocoal of the logarithm is proportional to the number of digits in a number, so it is also shown in the extended view. It uses a scale where decimal is 1, so when you see the value of 3.3219 in binary, you know that numbers in binary require ~3.32 times as many digits as decimal. ** Copyright & Contact Info radix_info: gives some information about number radices Copyright (C) 2023 Adrien Hopkins diff --git a/factor_info.go b/factor_info.go index 8939f5a..637bde2 100644 --- a/factor_info.go +++ b/factor_info.go @@ -139,6 +139,8 @@ func (fi *factorInfo) writeTo(w io.Writer) { low_mtc_est, high_mtc_est) } fmt.Fprintf(w, "Base-2 Logarithm: %.3f\n", fi.Log2) + fmt.Fprintf(w, "Number Length: %.4f×Decimal\n", + 1/math.Log10(float64(fi.Radix))) if len(fi.DigitMap) > 0 { writeDigitMap(w, fi.DigitMap) } -- cgit v1.2.3