# 2835: Factorial Numbers

 Factorial Numbers Title text: So what do we do when we get to base 10? Do we use A, B, C, etc? No: Numbers larger than about 3.6 million are simply illegal.

## Explanation This explanation may be incomplete or incorrect: Created by a VARIABLE-BASED BOT BEING ESCORTED OUT OF THE COMPUTER SCIENCE DEPARTMENT BY SECURITY - There is no explanation of the comic. There is a complex dive into the mathematics with no simplified explanation created to help understand the comic or its joke. Do NOT delete this tag too soon.If you can address this issue, please edit the page! Thanks.

This comic is based on the factorial number system, which is a way of writing integers or real numbers using factorials instead of powers.

Cueball proposes this number system with his key point being that small value numbers are described only with the small value digits (1, 2, or 3) and saving the larger digits (8 and 9) for larger value numbers. His proposed solution is a complicated number system that some (probably including at least one person able to summon security personnel) might consider unnecessarily clunky to be actually useful.

A factorial is a product of positive integers. For instance, four factorial, written '4!', means 4×3×2×1 = 24. These can be used to write numbers in a strange way.

Normally, numbers are represented in a positional system with a constant base, especially base ten. This means that each digit in a number has a place value based on its position, and that value is a power of ten. For instance, the number 137 usually means 1×102 + 3×101 + 7×100, i.e. one hundred, three tens, and seven units. We say that the 1 is in the hundreds place, the 3 in the tens place, and the 7 in the ones place (or units). The same number could be written in base sixteen as 89, meaning 8×161 + 9×160, i.e. eight sixteens and nine units. The 8 is in the sixteens place, and the 9 is in the ones place.

In a "factorial base," instead of each place value being an escalating power of some constant base, each place value is an escalating factorial. The amount to multiply each place value by to get the next place value increases by 1 each time. So that same number (137 in base 10) could be written 10221, meaning 1×5! + 0×4! + 2×3! + 2×2! + 1×1!. We could say there is a 1 in the 120s place, a 0 in the 24s place, a 2 in the 6s place, another 2 in the 2s place, and a 1 in the ones place.

True factorial numbers also include a 0s place, representing the 0 factorial of 0! Continuing our example of 137 in base 10, the values 1×5! + 0×4! + 2×3! + 2×2! + 1×1! + 0x0! would write out to 102210, but Randall's version truncates this rightmost 0 factorial since it is always a value of 0.

In normal base-n notation, n digits are used, running from 0 to n–1. For instance, in base ten, we use the ten digits {0,...,9}. In base sixteen, we need sixteen digits, so we use {0,...,9,A,...,F}. Any of these digits can be used in any position. But in factorial base, each position needs an increasing number of different digits to express all n-digit numbers. The comic labels each position with the equivalent base that would allow the same digits, e.g. the place value 3! is "base 4" because it uses the digits 0 to 3.

For instance, with just two digits, we can express some numbers with the digits 0, 1, and 2, like 21 = five. But we can't express 30 = six. As a result, Randall jokes that since we only have ten digits {0,...,9}, we can only express numbers with up to nine digits, making larger numbers "illegal." Randall believes that would make the largest "legal" factorial base number 987654321 = 9×9!+8×8!+7×7!+6×6!+5×5!+4×4!+3×3!+2×2!+1×1!, which in base ten is 3,628,799 (which he calls "about 3.6 million"). In fact, adding one to this number gives 1000000000, which still doesn't require any digits larger than 9, but he maybe wishes to stay away from the mere possibility of representing the digit that ought to use another symbol. The first number that actually cannot be represented with our usual ten symbols {0,...,9} comes right after 9987654321, which in decimal equals 36,287,999.

In the comic, the top example represents 3×720 + 5×120 + 3×24 + 0×6 + 1×2 + 1×1, after calculating each factorial accordingly, which gives the decimal value of 2835, this comic's number.

For completion of the examples shown in the panel, the numbers up to 200 in this variable base are:

1=1 2=10 3=11 4=20 5=21 6=100 7=101 8=110 9=111 10=120 11=121 12=200 13=201 14=210 15=211 16=220 17=221 18=300 19=301 20=310 21=311 22=320 23=321 24=1000 25=1001 26=1010 27=1011 28=1020 29=1021 30=1100 31=1101 32=1110 33=1111 34=1120 35=1121 36=1200 37=1201 38=1210 39=1211 40=1220 41=1221 42=1300 43=1301 44=1310 45=1311 46=1320 47=1321 48=2000 49=2001 50=2010 51=2011 52=2020 53=2021 54=2100 55=2101 56=2110 57=2111 58=2120 59=2121 60=2200 61=2201 62=2210 63=2211 64=2220 65=2221 66=2300 67=2301 68=2310 69=2311 70=2320 71=2321 72=3000 73=3001 74=3010 75=3011 76=3020 77=3021 78=3100 79=3101 80=3110 81=3111 82=3120 83=3121 84=3200 85=3201 86=3210 87=3211 88=3220 89=3221 90=3300 91=3301 92=3310 93=3311 94=3320 95=3321 96=4000 97=4001 98=4010 99=4011 100=4020 101=4021 102=4100 103=4101 104=4110 105=4111 106=4120 107=4121 108=4200 109=4201 110=4210 111=4211 112=4220 113=4221 114=4300 115=4301 116=4310 117=4311 118=4320 119=4321 120=10000 121=10001 122=10010 123=10011 124=10020 125=10021 126=10100 127=10101 128=10110 129=10111 130=10120 131=10121 132=10200 133=10201 134=10210 135=10211 136=10220 137=10221 138=10300 139=10301 140=10310 141=10311 142=10320 143=10321 144=11000 145=11001 146=11010 147=11011 148=11020 149=11021 150=11100 151=11101 152=11110 153=11111 154=11120 155=11121 156=11200 157=11201 158=11210 159=11211 160=11220 161=11221 162=11300 163=11301 164=11310 165=11311 166=11320 167=11321 168=12000 169=12001 170=12010 171=12011 172=12020 173=12021 174=12100 175=12101 176=12110 177=12111 178=12120 179=12121 180=12200 181=12201 182=12210 183=12211 184=12220 185=12221 186=12300 187=12301 188=12310 189=12311 190=12320 191=12321 192=13000 193=13001 194=13010 195=13011 196=13020 197=13021 198=13100 199=13101 200=13110

Note the apparent gap at 24 (4!) and 120 (5!) - apparent for those of us who are used to decimal numbers.

Factoradic™ numbers are actually less efficient than any other base. "Efficiency" for a base is normally defined by the radix economy. The actual definition is the size of the base (i.e. the number of possible digits) times the number of digits in a number, although it can be compared to binary-coded decimals. Instead of using actual binary, a binary-coded decimal stores each decimal digit as a binary number. For example, 42 becomes (0100)(0010). This uses 8 bits, which is less efficient than the actual binary value of 101010, which is only 6 bits. It can vary which base is more efficient, like how from 9 to 15, quaternary is more efficient (base 4 * 2 digits = radix economy 8) than ternary (base 3 * 3 digits = radix economy 9). But as the number being represented goes up to infinity, the further you get from a hypothetical base e, the less efficient you become. As a quick example to demonstrate why large bases are less efficient, consider the number 3600. In base 60, it's only three digits, 1;0;0, but because each of those digits can have 60 possible values, its radix economy is 3*60=180. But even though the decimal representation uses a 4th digit, since there are only 10 possible values for each digit, the radix economy is only 4*10=40.

For a k-digit factoradic™ number, the 1st digit can have 2 values, the 2nd can have 3, the 3rd can have 4, up to the k-th digit having k+1 possible values, so the radix economy is effectively (k+1)(k+2)/2 - 1. Unfortunately, this is substantially more difficult to calculate, because it involved the inverse gamma function. But if you use ln n / ln ln n as an approximation of the asymptotic behavior of the inverse of Stirling's approximation, you can set up the limit ln n / ln^2 ln n, which diverges as n approaches infinity. Therefore, at least if you let factoradic™ numbers use other symbols for digits and increase past 10!, then no matter how large and inefficient of a base you're comparing it to, factoradic™ numbers will eventually be less efficient. Meanwhile, if you do stop at 10!-1, it's 9 digits, so its radix economy is 54. And if you solve 54 = b*floor(1+ln(10!-1)/ln(b)) for b, you find that b is approximately 6.75. So factoradic™ is more efficient than base 7 and up, but less efficient than binary, ternary, quaternary, quinary, and senary.

## Transcript This transcript is incomplete. Please help editing it! Thanks.
[Cueball is standing in front of a large poster. There are two uniformed officers (a Ponytail and a further Cueball, wearing badged hats) approaching Cueball.]
[Poster:]
 Base 7 Base 6 Base 5 Base 4 Base 3 Base 2 3 5 3 0 1 1
Left side
 Base 10 Factoradic 1 1 2 10 3 11 4 20 5 21 6 100 7 101 21 311 22 320 23 321
Right side
 Base 10 Factoradic 24 1,000 25 1,001 5,038 654,320 5,039 654,321 5,040 1,000,000 999,998 266,251,210 999,999 266,251,211 1,000,000 266,251,220 1,000,001 266,251,221
Cueball: Small numbers like seven or nineteen shouldn't use big numerals like "7" or "9".
Cueball: I mean, "9" is the biggest numeral we have! It should be reserved for big numbers.
Cueball: Small numbers should be written with small numerals like "1" or "2".
Cueball: That's why my variable-base system uses...Hey! No, listen!
[Caption under the comic:] Factorial numbers are the number system that sounds most like a prank by someone who's about to be escorted out of the math department by security. add a comment! ⋅ add a topic (use sparingly)! ⋅ refresh comments!

# Discussion

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)

## Fractions

I have actually considered this system, though not with any illusion of its being useful. Any system "exists", just as any number "exists". A system where 1 = decimal 1, 10 = decimal 29, 100 = decimal 493 , exists in the monetary system of the Harry Potter world. An actual system existed where 1d = 1d, 1/- = 12d, £1/-/- = 240d.

It's only on seeing that someone else had come up with this system, that it's occurred to me to consider fractions. Any rational number has a finite number of places after the "factoradic" point. Anything with infinite repetition after the point is irrational. 1⁄2 = 0.1

1⁄3 = 0.021 [Corrected: 0.02]

1⁄4 = 0.0121 [Corrected: 0.012]

1⁄5 = 0.01041 [Corrected: 0.0104]

1⁄6 = 0.011 [Corrected: 0.01]

1⁄7 = 0.0032061 [Corrected: 0.003206]

1⁄8 = 0.0031 [Corrected: 0.003]

1⁄9 = 0.002321 [Corrected: 0.00232]

1⁄10 = 0.0022

π = 11.003156502.....

e = 10.11111111111111111111.....

```198.41.236.185 09:34, 13 October 2023 (UTC)
```

I am not following the fractions presented above after the first - if these are inverses of the left-of-decimal bases (excluding 1!), .1 = 1/2, .01 = 1/6, .001 = 1/24, etc., then I believe the corrections added above are appropriate (mostly removing a trailing 1). If I'm mistaken, perhaps it needs a bit more explanation? Regardless, e as a repeating value is delightful. Majuba 172.71.147.123 19:49, 17 October 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)
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)
nope
Sign your comments. :) And yup. Whenever someone makes an unreasonable objection, it MUST be ignored to tech unreasonable people to stop being ridiculous. :) NiceGuy1 (talk) 04:27, 19 November 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)

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)

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)

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; }
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)

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;
string digits;
while (num != 0) {
}
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++)
for (int i = 5038; i < 5042; i++)
for (int i = 999998; i < 1000002; i++)
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)

"Fandom crossover" with what, exactly? Just humour for Beavis & Butthead/Quagmire-style "sex, hee hee" people (such as myself), or is there some actual fandom you're referring to? As it is, I would have thought the proper word WOULD have "sex" in it, like sextillion does... :) NiceGuy1 (talk) 05:41, 7 October 2023 (UTC)
I'm assuming the jan Misali fandom. The guy is mostly known for his videos on constructed languages, but he also has strong opinions on base 6. As a reference, see his site seximal.net.

Can I politely note that your algorithm potentially has no end? num is never 0 because you're always dividing and never subtracting. My perl attempt goes through every radix up to around 180 before giving up. (Leave out the atoi and you'll see what I mean.) I might recommend capping radix at 9. Hymie (talk) 12:20, 9 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)

You may be right, I recall several (none specific come to mind, but I know it's a scenario Randall clearly enjoys). NiceGuy1 (talk) 05:41, 7 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)

"In this article, a factorial number representation will be flagged by a subscript '!'", that sounds like it's not a standard notation, just one THAT editor used for THAT article to clarify things when explaining it. NiceGuy1 (talk) 05:44, 7 October 2023 (UTC)
It's used at least in a *Scientific American* article from 4 years ago: https://blogs.scientificamerican.com/roots-of-unity/its-factoradical/