Difference between revisions of "Talk:2835: Factorial Numbers"

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
(Notation: new section)
Line 76: Line 76:
  
 
NiceGuy1 the wiki uses standard markdown, if you preface with 6 spaces, it will automatically recognize it as a code snippit. I appologize if my contribution was ill-thought out, though i have gone back and signed it. [[User:Drinkcoffeeandcode|Drinkcoffeeandcode]] ([[User talk:Drinkcoffeeandcode|talk]]) 20:06, 4 October 2023 (UTC)
 
NiceGuy1 the wiki uses standard markdown, if you preface with 6 spaces, it will automatically recognize it as a code snippit. I appologize if my contribution was ill-thought out, though i have gone back and signed it. [[User:Drinkcoffeeandcode|Drinkcoffeeandcode]] ([[User talk:Drinkcoffeeandcode|talk]]) 20:06, 4 October 2023 (UTC)
 +
:I called it "ill-thought out" for having no tags or markup, and thus figured it would be all mangled. :) I was mistaken. Good to know, except I don't see myself ever sharing code (I figure people generally aren't hanging out in a coding environment to just run random code like that. I myself don't have any place to try it these days, and if I did I don't prefer C so probably wouldn't have a C environment anyway). But the last time I wrote someone after an unsigned comment, some idiot manually marked it as mine (WHY would I reply to myself?), which I removed, and I don't know how to manually write someone else's sign in (and didn't want to hunt one down to SEE and learn how), so it's probably STILL unsigned. Usually when there's an unsigned comment someone who knows how checks the edit history to find the IP or name to add it. :) Oh, and usually if you want to reply to someone, you put a colon and place your reply below theirs (like this). :) [[User:NiceGuy1|NiceGuy1]] ([[User talk:NiceGuy1|talk]]) 04:29, 7 October 2023 (UTC)
  
 
== Factoradic Algorithms ==
 
== Factoradic Algorithms ==

Revision as of 04:29, 7 October 2023


Number systems aren't real math, at least not serious math. They're an affectation. 99.9% of math is number-system-independent, so nobody should care about them. 172.70.46.108 22:30, 29 September 2023 (UTC)

Of course it's "real math." There aren't that many applications, but so what? Math isn't about applications. Besides, there are some. Maybe not specifically for factorial base, but for some place systems. The only thing "dirty" about decimal is the arbitrariness of ten. Considering place systems in general is just considering special kinds of sums. Certainly, "serious" mathematicians are interested in proving numbers normal in specific bases, or in every base. EebstertheGreat (talk) 01:55, 30 September 2023 (UTC)
A great deal of interesting maths can be found in and around he various arrangements of digits in number systems, surely. AzureArmageddon 07:54, 30 September 2023 (UTC)

I thought this was a complete joke, until coming here. The "factorial number system" exists?! 162.158.90.249 22:38, 29 September 2023 (UTC)

Yup, complete news to me too... What's REALLY weird: the night before this comic I was tutoring a friend's daughter in math, and I happened to teach her what factorials are! (News to me there's a number system, though)... NiceGuy1 (talk) 04:59, 1 October 2023 (UTC)

I wanted to add a link to a converter, but the one I found is https://www.dcode.fr/factorial-base which is quite ugly with lots of adds and a bit counter-intuitive.--Pere prlpz (talk) 23:42, 29 September 2023 (UTC)


This needs simplifying a bit. Came here because I had no idea what was going on, and after a quick scroll through the prose, the main thing I learned was "it's 'cause you're dumb". May be true but I still don't get what Randall's factorial system is....Alcatraz ii (talk) 01:25, 30 September 2023 (UTC)

Factorial base also allows to finitely represent all rational numbers - no constant base is capable of that! 172.68.238.76 01:55, 30 September 2023 (UTC)

Unless you use a division sign. But yes, only radix numerals of a variable base with infinite series of factors of every prime can even theoretically finitely represent arbitrary rationals without invoking existential quantifiers. 172.71.147.26 06:43, 30 September 2023 (UTC)

I feel like Michael when Oscar is trying to explain what a “surplus” is.162.158.186.241 04:12, 30 September 2023 (UTC)

Bruh, same, and I'm a stats major. This "explanation" sorely needs a couple paragraphs of ELI5 introductory exposition for English majors between the first and second sentences. 172.69.134.16 13:11, 5 October 2023 (UTC)

The warning is complete nonsense, just remove it

bots cant be escorted out of somewhere just remove the stupid warning 162.158.203.109 04:28, 30 September 2023 (UTC)

you must be new here - 108.162.216.143 15:51, 30 September 2023 (UTC)
The nonsense is part of the fun. AzureArmageddon 07:52, 30 September 2023 (UTC)
im deleting it 162.158.203.80 (talk) 11:16, 30 September 2023 (please sign your comments with ~~~~)
Premature elision. Still has a purpose (as does signing your contributions here). 172.71.178.208 14:58, 30 September 2023 (UTC)
*sigh* As has been stated, you MUST be new here. The "incomplete" tag goes on new comics while their descriptions are still in flux. When the bot creates the empty description page, it does so with the Incomplete warning, labelled with its name. On the first edit, someone ALWAYS changes the name to some silly gag that's related to the comic, often pretending it's the name of the bot that created the page for us. In this case the comic shows Cueball being escorted out, so the joke is the bot is being escorted out. If you're not going to have a sense of humour, why are you here? Just leave the editing to others in the meantime. :) (Oh, and as the user above noted, make sure to end your comments with ~~~~ (4 tildes), like it says at the top of the editing text box you type in). :) NiceGuy1 (talk) 05:13, 1 October 2023 (UTC)
Okay, now the Incomplete warning needs to stay up forever. :) NiceGuy1 (talk) 05:13, 1 October 2023 (UTC)
In case you weren’t aware, this wiki has a tradition of humor. This is one of its examples. 172.68.58.134 12:56, 2 October 2023 (UTC)

The "adic" part of factor-adic numbers

It's not explicitly mentioned in the comic but the "adic" in the name "Factoradic™" implies that the number system extends the factorial number system by being in some way "adic" as discussed in this YouTube video on the Veritasium channel and so negative numbers would have a truly wacky representation that violates the intent of the title text's pronouncement by requiring an infinitely long representation requiring infinite digits (1, 2, 3, 4, ..., 9, A, B, C, ..., infinite digits). AzureArmageddon 08:00, 30 September 2023 (UTC)

The "adic" in factoradic doesn't actually relate to p-adic numbers of any kind. Rather, both factoradic and p-adic numbers use the suffix -adic to refer to the concept of adicity, which is "The number of arguments or operands a function or operation takes" according to Wiktionary. Each place value of a p-adic number had p possibilities, and each place value in the factoradic system has a number of possible arguments determined by the factorial of the place. Factoradic would be better called "factorary" since it's more similar to ordinary n-ary number systems, but I guess it just isn't. 172.69.205.130 20:43, 30 September 2023 (UTC)
Ah, today I learned. AzureArmageddon 15:35, 1 October 2023 (UTC)

Title text

The title text references that 10! = 3,628,800 (base 10), and so for numbers greater than or equal to that, you would have to add a tenth digit in order to display them in this system. The question is asking whether you would then proceed to using letters of the alphabet such as one does in hexadecimal to which the reply is that numbers above this amount are simply illegal. The trouble comes when you try to write down the number 10 * 10! = 36,288,000 (base 10) in this system. For 10!, the notation is 1000000000 , so 9 * 10! would be 9000000000, and then to get 10 * 10!, you would have to write A000000000 because 10 * 10! < 11!. In fact, since this is the first "illegal" number, you could "legally" allow up to 10 * 10! - 1 = 36,287,999 (base 10) in the system (which would be written as 9987654321 = 9 * 10! + 9 * 9! + 8 * 8! + ... + 2 * 1! + 1 * 1!) without the need to introduce any letters. I also want to point out that the reference in the comic to 9 being reserved for big numbers is due to no number needing a 9 to write it down in this system until 9 * 9! = 3265920 which is written 900000000. Since numbers above 10! are not allowed, this means that only the 9! digit is legally allowed to hold a 9, and it only applies to numbers in that high range of 3265920 to 3628799.172.71.166.230 15:01, 30 September 2023 (UTC)

I feel the current in-Explanation explanation about that already covers this, with the addition of the validity that the digit that could need to be >9 could still be any digit 0..9 without needing to invoke the 11th digit. (Maybe a few tweaks, but not sure what you're trying to add here.) 172.70.86.148 15:13, 30 September 2023 (UTC)

Radix Economy

Someone got in there just before I did, about (from a quick scan of what's been added) "economical" use of Factorial-based variable radices. (I was planning both the test code and the explanation for this, whilst travelling.) My short way of putting it is that (apart from values of zero or one, which represent identically in Factorial-based notation to any other notation in base of 2+) the Factorialised method initially is using up 'places' quicker until the point at which it has reached a 'magnitude' equal to its base-normal 'original' (i.e. only when there are N glyphs made available under Factoradic notation does it not rush through the 'magnitude' quicker than the base-N number). And then, it needs to work up into the more 'efficient' higher-order digits in order to pull back the disadvantages of its lower-order ones and equal, then be shorter than, any given value's respective base-N form.
Now, I've done some very rough calculations (started hitting numbers for which I really need to convert everything into high-precision large-number data types, which needs me to rewrite one or two elements of my existing code) and looked at the successive changes of magnitude, in each base, and checked the calculated Factoradic length (with the assumption that there are enough extended glyphs to represent every digit singly, unlike the comic Title Text speculation).
By my reckoning, Base-2 is more efficient at 20fact (compare with 1002, =410); Base-3 breaks better at 3111fact (100003, =81); Base-4: 540220fact (10000004, =4096); Base-5: 533340021fact (10000000005, =1953125); Base-6: 90967344000fact(1000000000006, =362797056); Base-7: 7ABAA086002001fact(1000000000000007, =678223072849); Base-8: D73A256860540220fact(100000000000000008, =281474976710656); Base-9: B1HEA65678836651220fact(100000000000000008119, =1350851717672992000) ...but at this point, the conversion of decimal to its base-9 form (and that powers of 9 should never have trailing zeros!) shows I may very well have hit a limit to normal large-number precision, so I really can't trust the subsequently derived base-10 values.
But, in case anyone wants it, the following is my (Perl, but should be easily convertible into most medium-to-high level code dialevts) en-Factoriadialising function.

sub factadic { my ($n,$place)=(@_,1);
  return () unless $place;
  if ($n>=fact($place+1)) { return factadic($n,++$place) }
  my $digit=0; my $base=fact($place);
  while ($n>=$base) { $digit++; $n-=$base; }
  my @return=($digit,factadic($n,$place-1));
  return @return;
}

You call it as factadic(<value>). Or factadic(<value>,<minimum_digits>) to start with the assumption of at least a minimum number of digits, but it'll start by shifting the default minimum of 1 into the <script>$place</script> variable if you don't give it that (there are other ways that you can/must do that, of course), and it will still always expand that to the degree necessary in the first phase of 'diving in' as far as it needs to in order to agree with the fact() function (factorial calculator, a trivial coding issue that I only use here like this because I alreadu set it up for another bit of code).
It returns an array (@-variable, in Perl) of digits, in standard most-to-least-significance order, that you can convert to a glyphwise notation in any way that you wish (or do a string conversion within the function, at each stage of building it up). ...and I'm presenting a slightly less optimised version of it here (some of the Perl-tricks I originally used don't translate well into some non-Perl) and, yes, the while ($n>=$base) loop could be done using modulus and integer-division, but it's a fairly trivial part of the looping process.
If you have any real problems with it, it's probably going to be if you're hitting any recursion-depth limits (especially as it uses roughly twice as many recursive calls as the eventual notation-length it produces). I also have a 'stack-based' version (loops round as it shifts in enough 'slots', then works back down again assigning the place-values) which avoids such trouble, but that's coded in a slightly esoteric Perlish way that I'm not sure most of you'd appreciate. ;) 141.101.76.77 20:25, 30 September 2023 (UTC)

Probably a double precision floating point accuracy limitation, you can only get up to 2^53 = 9007199254740992 before many modern programs start getting numerically fuzzy. But what weirds me out is you seem to have gotten 1350851717672992900 out of what should have been 9^19 = 1350851717672992089, instead of a nearby float of 1350851717672992768 or 1350851717672993024. What is it with things rounding to decimal like that? 172.71.147.84 11:43, 1 October 2023 (UTC)
One 'solution' is to use Math::BigFloat (or similar), in the Perl, and make hold such sensitive and large-tending values. Alternately, implement an array of digits in a raw manner (can be of entirely arbitrary base, explicitly, plus arbitrarily long; well, as long as one doesn't hit other data limits!) and make your own long-division/etc algorithms. Or pack bitwise/bytewise data as a 'string', with suitable overloaded/replacement mathematical functions. But it all adds extra coding effort, of course. And I rarely share my various hacked-together bits of Perl, because they either work but look horrible or they don't work (and probably look strange, even to me - hence why I've failed to discover why they don't work!). 172.71.98.87 19:39, 1 October 2023 (UTC)
Just analyzed the growth rate; For base x, the length can be estimated by 1/2+e*x-e-1.487*ln(x). Maybe a more sniped nerd can get more precision, or even an exact solution; but this is within a digit of the result up to around base 10^13, and then I start running into precision problems in general, so I'm just putting this here as a good enough guess. 172.71.146.129 13:20, 1 October 2023 (UTC)

Factorial numbers is new to me... It sounds more like a coding system than a number system, LOL! "The door code is 4503 in factorial! Figure it out!" (I'd write this on the bottom of the comments as usual, but I don't want to get mixed up with that ill-thought out and unsigned coding sample Algorithm and table that I KNOW must be mangled when published because the wiki refuses to honour single Newlines. Clearly the author didn't take a peek at what it looks like when published EDIT: Correction, wow, the wiki spotted the code and marked it as such automatically (for now), wow!) :) NiceGuy1 (talk) 04:59, 1 October 2023 (UTC)

All the stuff about economy / efficiency doesn't seem to really have any direct relation to the comic, so I'd suggest it doesn't really belong in the explanation, but should be confined to the comments, or at least to a trivia section. Not least because it dives off into a lot of technical stuff that itself requires explanation for a significant part of the readership. As it is, it's doing more to confuse than to explain.172.70.85.218 09:02, 2 October 2023 (UTC)

I sort of agree, in that I had planned something similar about 'notation economy' as a Trivia-like addendum, before others got there before me. But there could at least be something to be said that by reserving higher-digits(/dissalowing them in lower values), Cueball/Randall is sacrificing conciseness for (one idea of) aestheticism. (And that's without going into 'how much storage it takes to store each digit', which I wasn't going into. So rather than the idealised radix being base-'e', I would have said the idealised base was whatever base-number exceeded the highest value, so it was just one (different) single squiggle for everything. Obviously, there's necessary entropy in the choice of differentiatable squiggles/encoding, though, which is why I also appreciate the current Explanation's blurb.) 172.70.90.52 10:15, 2 October 2023 (UTC)

NiceGuy1 the wiki uses standard markdown, if you preface with 6 spaces, it will automatically recognize it as a code snippit. I appologize if my contribution was ill-thought out, though i have gone back and signed it. Drinkcoffeeandcode (talk) 20:06, 4 October 2023 (UTC)

I called it "ill-thought out" for having no tags or markup, and thus figured it would be all mangled. :) I was mistaken. Good to know, except I don't see myself ever sharing code (I figure people generally aren't hanging out in a coding environment to just run random code like that. I myself don't have any place to try it these days, and if I did I don't prefer C so probably wouldn't have a C environment anyway). But the last time I wrote someone after an unsigned comment, some idiot manually marked it as mine (WHY would I reply to myself?), which I removed, and I don't know how to manually write someone else's sign in (and didn't want to hunt one down to SEE and learn how), so it's probably STILL unsigned. Usually when there's an unsigned comment someone who knows how checks the edit history to find the IP or name to add it. :) Oh, and usually if you want to reply to someone, you put a colon and place your reply below theirs (like this). :) NiceGuy1 (talk) 04:29, 7 October 2023 (UTC)

Factoradic Algorithms

there are several ways to compute the factoradic of a base 10 number, depending on the choice of language the length of the program will be demonstrably bigger. Dynamically typed languages, like perl can likely perform this in one or two lines, where as a language like c++ will be longer.

The simplest algorithm is to generate the digits from right to left one at time by dividing the number by a per-iteration-incrementing radix starting from 2 (because 1 is simply '0', we start from 2), taking the result and repeating until the quotient reaches zero:

    #include <iostream>
    #include <algorithm>
    using namespace std;
    int factoradic(int num) {
       string digits;
       int radix = 2;
       while (num != 0) {
           digits.push_back(((num % radix)-'0'));
           num /= radix++;
       }
       reverse(digits.begin(), digits.end());
       return atoi(digits.c_str());
    }

Using Randall's values we can confirm it is correct:

    int main(int argc, char* argv[]) {
        for (int i = 21; i < 26; i++) 
            cout<<i<<" - "<<factoradic(i)<<endl;
        for (int i = 5038; i < 5042; i++) 
            cout<<i<<" - "<<factoradic(i)<<endl;
        for (int i = 999998; i < 1000002; i++) 
            cout<<i<<" - "<<factoradic(i)<<endl;
        return 0;
    }
    max@laptop:~/$ ./factoradic
    21 - 311
    22 - 320
    23 - 321
    24 - 1000
    25 - 1001
    5038 - 654320
    5039 - 654321
    5040 - 1000000
    5041 - 1000001
    999998 - 266251210
    999999 - 266251211
    1000000 - 266251220
    1000001 - 266251221

Came back to sign code sample after seeing NiceGuy1's comment. Drinkcoffeeandcode (talk) 20:02, 4 October 2023 (UTC)

I would love to have some kind of explanation as to why this number system exists/what it's used for in the real world. (Even if that explanation is just "there's no practical purpose, mathematicians just love doing this stuff".) 172.70.134.87 14:55, 2 October 2023 (UTC)

Would it be too much of a fandom crossover to edit / annotate the last word of the explanation (at time of commenting, the word "senary") to "seximal"? Or, given that we are discussing intentionally silly base systems, just the right amount of a fandom crossover? 172.71.242.176 08:14, 5 October 2023 (UTC)

Category

There should be a category where presenters are escorted by security, or are about to be.--162.158.87.153 12:27, 6 October 2023 (UTC)

Notation

wikipedia:Factorial number system uses the 3121! style notation. Should probably be used in the explanation, together with the 8310 notation. --162.158.87.154 12:42, 6 October 2023 (UTC)