summaryrefslogtreecommitdiff
path: root/README.org
blob: ad462e4cb6b478a0af2b1218aea74ef5696c62bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
* Radix Info Script
This is a script that gives you important information about number radices.  It is designed with the intent of helping you decide which one is the best.
** Usage
This is a command-line program.  To get radix info, type its name then the radix you want to get info on, e.g. ~radix_info 10~.  There are also many flags you can add before the radix to modify its behaviour; to get more information type ~radix_info -?~.  For example, ~radix_info -c [radix]~ prints the info in a more compact display, useful for comparing radices with each other.
** Versioning/Backwards Compatibility
This program uses Semantic Versioning.  The public API consists of all exported values in every package in this codebase.

There is one exception - the import path currently being used is temporary.  When I publish this script, it will change to match that without incrementing the major version.  Until it is published, you shouldn't depend on the import path to import it.
** The Prime Factorization
The first thing this script shows is the decomposition of a number into a product of prime numbers.  The prime factorization is fundamental to the number theory that this field of math is based on, and can be used to do many things.  For example:
- If you know a number's prime factorization, you can easily determine whether it's a factor or not.  Just check if all of the number's exponents for each prime are less than or equal to the radix's exponents.  For example, ~2 × 3~ is a factor of ~2^2 × 3~, while ~2 × 5~ is not.
** The Digit Map
The digit map shows all of a radix's digits and their relationships with the radix.  These relationships affect how easy it is to do certain operations (multiplication, division, remainder) with certain numbers.  Factors (coloured blue) and special numbers (coloured purple) are the best for all operations, but other types are more complicated.

This classification is done by splitting a digit into a product of two parts: the *regular part* which contains all of the prime factors the digit has in common with the radix, and the *totative part* which has the rest (and is coprime with the radix).  Then,
- The *regularity index* is calculated as the exponent of the smallest power of the radix that is divisible by the regular part.  This number becomes the first part of the two-digit code for each digit ('+' means something above 7).
- The totative part is classified based on how complicated it is.  The colours distinguish between neighbourly totatives (factors of (r - 1) (r + 1)), and opaque totatives (others).  This is changed into a letter to make up the second part of the digit's code.  See the documentation of ~factors.TotativeType~ for more info.

The colours offer a simpler classification:
- Factors :: Numbers that the radix is divisible by.  These are coloured blue and always have the code 1R.  /Note that factors are a type of regular number, specifically 1-regulars./
- 2-Regulars :: Numbers that the radix's square is divisible by.  These are coloured cyan and always have the code 2R.
- Other Regulars :: Numbers that a larger power of the radix is divisible by.  These are coloured green and have codes 3R-7R or +R.
- Neighbourly Totatives :: Numbers coprime to the radix, but that are factors of (r - 1) (r + 1), which makes them easier to work with than other totatives.  These are coloured pink and have the code 0ω, 0α or 0N.
- Opaque Totatives :: Other numbers coprime to the radix.  These are coloured red and have the code 0P.
- Neighbourly Semitotatives :: Products of a regular and a neighbourly totative.  They are coloured yellow and their codes end in ω, α or N but don't start with 0.
- Opaque Semitotatives :: Products of a regular and an opaque totative.  They are coloured orange and their codes end in P but don't start with 0.
- Zero and One :: 0 and 1 are special and don't fit into any other category.  They are coloured purple and always have the codes 00 and 0R.  Multiplication, division and the remainder operation on 0 and 1 all work the same in every radix, following the rules you expect.
*** Multiplication
Firstly, digit types affects the multiplication table.  This is different in every radix, and a digit's type determines what sort of pattern that digit's multiplication table row has.
- For factors, the last digit of the products will follow a simple pattern.  For example, 5 is a decimal factor and its multiplication table row goes ~00 05 10 15 20 25 30 35 40 45~.
- For other regulars and semitotatives, the last digit of the products will follow a complex pattern.  For example, 6 is a decimal semitotative and its multiplaction table row goes ~00 06 12 18 24 30 36 42 48 54~.
- Totatives don't have any patterns (or they have a pattern that doesn't repeat).  For example, 7 is a decimal totative and its multiplication table row goes ~00 07 14 21 28 35 42 49 56 63~.
- 0 × a = 0 and 1 × a = a.
*** Division
Digit types also affect the decimal expansion of fractions of a digit.
- Fractions over factors and regulars have a finite number of digits in their decimal expansion, equal to the regularity index.  For example, 1/2 (1R) is 0.5, 1/4 (2R) is 0.25 and 1/8 (3R) is 0.125.
- Fractions over totatives have a repeating decimal, with the pattern determined by the totative type:
  - Factors of (r - 1) (denoted by 'ω') have one digit repeating.  For example, 1/3 (0ω) is 0.333333...
  - Factors of (r + 1) (denoted by 'α') have two digits repeating, where the two digits add up to (r - 1).  For example, 1/11 (0α) is 0.09090909...
  - Other factors of (r - 1) (r + 1) (denoted by 'N') have two digits repeating with no pattern.  For example, 1/33 (0N) is 0.03030303...
- Semitotatives combine the regular and totative decimals, with some finite digits followed by a repeating pattern.  For example, 1/6 (1ω) is 0.1666666...
- 1/0 is undefined and 1/1 = 1.
*** Remainder
Finally, digit types affect what sort of tricks you can use to test for divisibility and remainders.

- For regulars with regularity index /r/, numbers share their remainder with the rightmost /r/ digits.
  If you want to know if a number is divisible by the regular, just memorize the list of that regular's multiples up to the /r/-th power of the radix, and test if the number's end matches.
- For totatives, the available tests depend on the totative type:
  - For totative type ω, numbers share their remainder with the sum of their digits.  To test divisibility, keep taking this sum until you get a number you recognize as definitely a multiple or not a multiple.
  - For totative type α, you can use a sum like with ω, except you need to alternate adding and subtracting.  If you're trying to determine the remainder, make sure the last digit is added, not subtracted.
  - For totative type N, take the sum of pairs of digits.  This sum will have the same remainder as the original number.  This test also works with types ω and α.
  - For opaque totatives, there is no automatic simple test.  There are more complicated tests that support /some/ opaque totatives, but there's no guarantee of a useful divisibility or remainder test. \\
    Smaller opaque totatives (5, 7, 9) do have tests that work in all radices.  In particular, radices where 5 is an opaque totative (e.g. 8 and 12) support the [[https://dozenal.org/drupal/content/dozenal-divisibility-rules.html][Split, Promote, Discard]] test, which can be used to test for divisibility by 5.
- For semitotatives, combine the tests for their regular and totative parts.  For example, to test for divibility by 6 in decimal, test if it is divisible by 2 and 3.
** Factor & Regular Utility Score
Given how useful factors and regulars are, the FUS and RUS attempt to measure how useful a radix's factors and regulars are.

Each factor is given a score of 1/f, and these scores are added up to get a radix's factor score.

The RUS does the same, but for regulars instead of factors.  It is useful for determining how useful a radix's prime factors are.
** 2345 Rank
The 2345 Rank classifies radices by how well they work with the first few numbers (2, 3, 4 and 5) - specifically, which types these digits have on the digit map.

The letter determines the type of 2, 3 and 4:
- A Tier :: 2, 3 and 4 are all factors.
- B Tier :: 2 and 3 are factors; 4 is a 2-regular.
- C Tier :: 2 and 4 are factors; 3 is a totative.
- D Tier :: 2 is a factor, 3 is a totative and 4 is a 2-regular.
- E Tier :: 3 is a factor; 2 and 4 are totatives.
- F Tier :: 2, 3 and 4 are all totatives.

The sign after the letter determines the type of 5.  A plus sign indicates it is a factor.  A neutral tilde (~) indicates it is a neighbourly totative, while a minus sign indicates it is an opaque totative.
** Totatives
Totatives are coprime to the radix and are one of the worst types of digits.  ~radix_info~ counts the number of totatives and the % of digits that are totative.

If you use the ~-t~ flag, ~radix_info~ tells you specifically which digits are totative.  All prime numbers that aren't factors of the radix will end in one digits.  For example, primes besides 2 and 5 end in 1, 3, 7 or 9 in decimal.
** Compositeness Type
Some radices fall into certain classes that indicate they have many useful factors (and therefore are good radices).  ~radix_info~ tests for four of these classes.  Each of these classes is a subset of the previous, so only the narrowest one is shown - every member of a class is also a member of all of the previous ones.  However, because these classes are based on the assumption that smaller radices are better, they can be ignored before ~12 where smaller is not better.
- Practical :: A practical number can make any number less than itself by summing its factors (without duplication).  This property is sort of useful, but the more important reasons why I included this is because it generally indicates that a large radix has enough factors to be worthwile.  I automatically reject non-practical radices above 16.
- Ordered-Exponents :: All of the exponents in the prime factorization are in order from greatest to smallest (including zero exponents, which aren't shown).  If a number doesn't have these ordered exponents, you can get the same number of factors with a smaller number by simply swapping some primes in the factorization.
- Superabundant :: The number's FUS is higher than that of any smaller number.  Superabundant numbers can be considered the best radices within their range.
- Colossally Abundant :: Pick a positive number e, and adjust the FUS for size by dividing each FUS by the radix to the power of e.  Then, one number will have the best adjusted FUS out of all possible radices (the ultimate winner is different for different values of e).  These numbers are called colossally abundant numbers, and they can be seen as the best radices (in terms of factors).
** Multiplication Table Complexity
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.
** Natural Logarithm
The radix's natural 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, numbers in radix a will have ln(b)/ln(a) times as many digits as numbers in radix b.  For example, ln(20)/ln(10)≈1.30, so decimal numbers will have around 30% more digits than vigesimal numbers.
** Copyright & Contact Info
radix_info: gives some information about number radices
Copyright (C) 2023  Adrien Hopkins

This program is free software: you can redistribute it and/or modify
it under the terms of version 3 of the GNU General Public License
as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

I can be found at <adrien.p.hopkins@gmail.com>.
I accept emailed patches there (more info at https://git-send-email.io/)!