If you haven't heard of this then a quick explanation: the place value of each digit in a factoradic number is a factorial. In a number base such as decimal, the radix remains the same (10) for each place value, but in the factoradic system the radix takes on the values of sucessive factorials (starting at 0! or 1!).

For example 1410 in the factorial base is written as 210, which can be interpreted as 2 * 3! + 1 * 2! + 0 * 1! and 5910 is 2121 = 2*4! + 1*3! + 2*2! + 1*1!

I find this idea exceptionally cool for no reason, and I got thinking about an algorithm for converting decimal to factoradic. Since there isn't a fixed radix, repeatedly taking the remainders on division by the radix isn't a solution (as would be done for conversion to say binary). The only way I can think of is to look for the largest factorial which divides into a number and write down the quotient from dividing by this, then repeat the process for the remainder, also writing down zeros for each factorial which doesn't work.

e.g. to convert 9810:

Factorial divisors of 98 are 0!, 1!, 2!, 3! and 4! and of these 4! is the largest

I apologise if it's in the wrong place. I intended this to be a mathematical post as I wanted to share and discuss the idea of factoradic numbers - even if at least half the people on this forum have seen them before. The question of a more efficient algorithm was just something I tagged on the end as I spent a while thinking about the problem last night and wanted to see if anyone could better me (quite likely )

But wouldn't you need infinitely many different symbols for single digits? How would you write n*n! in factorial base, without using any symbols denoting numbers larger than n-2? A positional numeral system seems pretty crappy if you need a symbol for every number to write it, because you're wasting the power of a positional numeral system.

Edit: mathematics seems to be the right place to me. There is overlap between math and computer science, of course, but the mere fact that a post uses the word algorithm doesn't make it a computer science post.

I don't see why the normal division algorithm wouldn't work.Divide by 2, remainder is the 1!'s digit.Divide the quotient by 3 (so you get the original number divided by 3!), remainder is the 2!'s digit.Divide the quotient by 4 (so you get the original number divided by 4!), remainder is the 3!'s digit; and so on.

Goplat wrote:I don't see why the normal division algorithm wouldn't work.Divide by 2, remainder is the 1!'s digit.Divide the quotient by 3 (so you get the original number divided by 3!), remainder is the 2!'s digit.Divide the quotient by 4 (so you get the original number divided by 4!), remainder is the 3!'s digit; and so on.

*checks*

Damnit you're right!... now why didn't that work when I tried it the first time? I'm blaming tiredness.

How do you propose to write fractions? You can't do a 0! + b (-1)! +... because negative factorials don't work. You could do a 1! + b / 1! + c / 2! + ... but then you have a problem that you're leaving out 0! and 1! = 1/1!. Can you represent any decimal number like this somehow? Would they have a unique representation?

I study theoretical physics & strings, and am a recipient of the prestigious Jayne Cobb Hero of Canton award.

And the science gets done and you make a neat gunFor the people who are still alive!

LoopQuantumGravity wrote:How do you propose to write fractions? You can't do a 0! + b (-1)! +... because negative factorials don't work. You could do a 1! + b / 1! + c / 2! + ... but then you have a problem that you're leaving out 0! and 1! = 1/1!. Can you represent any decimal number like this somehow? Would they have a unique representation?

I'm not quite sure how you'd work out fractions, but it would have to be like b/1!+c/2! etc.

Which means that all rationals terminate in base !.

The uniqueness is puzzling, BUT I think you can just reduce as fractions do, albeit with much more thought, ie

where ak, bk are integers less than or equal to k. More than a little asymmetric (since the indices of the b's are one off from the corresponding a's), but I think it gives unique representation.

Well you really need some restrictions on the coefficients if you want that to be useful. Eg, in base 10, each digit is between 0 and 9. If you keep your 0 <= bn-1 <= n, I don't think you'll be able to get every number, and if you limit it to between 0 and n!, you'll get many different representations for numbers (and in fact, possibly divergent representations, like the number with coefficients 2!,3!,4!,... so you number would be sumn=1infinity 1 = infinity.)

I study theoretical physics & strings, and am a recipient of the prestigious Jayne Cobb Hero of Canton award.

And the science gets done and you make a neat gunFor the people who are still alive!

LoopQuantumGravity wrote:Well you really need some restrictions on the coefficients if you want that to be useful.

You're right. I should have included the word "nonnegative". But otherwise, I think my restrictions are perfectly fine. Am I wrong? Is there some number that you can't get this way?

If you let them be any positive number, then you can get to any number in infinitely many different ways, in a similar manner to how my previous example gave how only using positive numbers you could get divergent sequences.

I study theoretical physics & strings, and am a recipient of the prestigious Jayne Cobb Hero of Canton award.

And the science gets done and you make a neat gunFor the people who are still alive!

(The reason I'm so confident: in the system I described, 1.000 = 0.123456.... Similarly, 1.0213500000... = 1.021346789A..., and in general the smallest number you can make starting with ***.*****k is equal to the largest number you can make starting with ***.*****(k-1). My analysis background is shaky, but is that not sufficient proof that there are no "gaps" in this system? Sure, we've got double-representation of numbers ending in all zeroes, but we had that in base 10 too. Who cares?)

skeptical scientist wrote:I'm sorry, but a positional numeral system which needs a different symbol for every whole number is worthless as a positional numeral system.

I will never understand the vagaries of a pure mathematician deciding what is and isn't useful. But yeah, I get your point.

Heh. Good point. I actually was wondering to myself how I can consistently think that factorial base is useless and phinary is cool just because factorial base needs infinitely many numerals. After all, it's not like anyone uses either for counting. But it's still true.

I'm looking forward to the day when the SNES emulator on my computer works by emulating the elementary particles in an actual, physical box with Nintendo stamped on the side.

Come on now. You've been on this forum for over a week, so it's time you stopped acting all ornery. I posted an argument above for why the system works, and apparently it was enough to convince at least one smart guy. If you have a problem with the argument, tell me where it is.

Come on now. You've been on this forum for over a week, so it's time you stopped acting all ornery. I posted an argument above for why the system works, and apparently it was enough to convince at least one smart guy. If you have a problem with the argument, tell me where it is.

Your problem is that it isn't an argument at all. You made a claim, and said "there, that's it!" That's not a proof. You didn't justify your claim, you didn't provide any support for your claim, and you didn't justify why your argument supports your conclusion. That's not how math works. In fact, your argument ended with "my analysis background is shaky" which really doesn't help your proof at all.

I study theoretical physics & strings, and am a recipient of the prestigious Jayne Cobb Hero of Canton award.

And the science gets done and you make a neat gunFor the people who are still alive!

Buttons, paraphrased wrote:The reason I'm so confident: in the system I described, 1.000 = 0.123456.... Similarly, 1.0213500000... = 1.021346789A..., and in general the smallest number you can make starting with ***.*****k is equal to the largest number you can make starting with ***.*****(k-1). Therefore, there are no "gaps" in this system

not an argument? It's not a proof in and of itself, but it can be turned into one:

Lemma 1: In Buttons' system, the smallest number you can make starting with ***.*****k is equal to the largest number you can make starting with ***.*****(k-1).

Proof of Lemma 1: Since the smallest number starting ***.*****k continues with all 0s, and the largest number starting ***.*****(k-1) continues with the largest possible numeral in each position (i.e. n-1 in the 1/n! place), it suffices to show that 1/n!=n/(n+1)!+(n+1)/(n+2)!+...

We show by induction that n/(n+1)!+(n+1)/(n+2)!+...+(n+k)/(n+k+1)!=1/n!-1/(n+k+1)!

When k=0, we get n/(n+1)!=(n+1)/(n+1)!-1/(n+1)!=1/n!-1/(n+1)!, so the base case is true.

For k>0, we have, by the inductive hypothesis,n/(n+1)!+(n+1)/(n+2)!+...+(n+k)/(n+k+1)!=1/n!-1/(n+k)!+(n+k)/(n+k+1)!=1/n!-(n+k+1)/(n+k)!+(n+k)/(n+k+1)!=1/n!-1/(n+k+1)!as desired.

This tells us the sum of the first k terms of the series is 1/n!-1/(n+k+1)!, so the sum of the series is 1/n! as claimed.

□

Lemma 2: If x is a real number 0<x<1, there are integers b1, b2, b3, ... with 0 ≤ bk ≤ k such that x=Σk=1∞ bk/(k+1)!

Proof of Lemma 2: Let bn be the largest integer ≤ n so that Σk=1n bk/(k+1)! ≤ x. Then the sequence of partial sums is monotone increasing and bounded by x, so the series converges to a real number s less than or equal to x. Suppose s<x. Then for some N, 1/N! < x-s, so for n>N, Σk=1n bk/(k+1)! ≤ s < x-1/n!, and therefore bn is not the largest integer so that Σk=1n bk/(k+1)! ≤ x. We therefore have bn=n for all n>N. We therefore have a last m with bm<m, since we can't have bm=m for all m with x<1. But by lemma 1, the sum of terms after the mth is equal to 1/m!, hence we can replace bm by bm+1 and still get a partial sum ≤ x, contradicting our choice of the numbers bn. Therefore we must have x=s=Σk=1∞ bk/(k+1)! as claimed.

□

Combining lemma 2 and the fact that all positive integers can be written as a sum of factorials where n! appears at most n times, we have the following theorem:

Theorem: All positive real numbers can be represented in the form Buttons described.

□

The full proof is of course more complicated than Buttons' argument, but Buttons' argument provided the basic framework that I fleshed out into a proof.

I'm looking forward to the day when the SNES emulator on my computer works by emulating the elementary particles in an actual, physical box with Nintendo stamped on the side.

More generally, given a sequence b1, b2, ... of positive integers [Edit: where infinitely many of them are greater than 1], we can define a numeral system based on this sequence, where anan-1...a1a0 represents Sumk=0n(ak*Prodj=1kbj).

If you only allow 0<=ak<bk+1, then every nonnegative integer is represented uniquely in this system.

You can also take a double-sided sequence ..., b-1, b0, b1, b2, ... and let anan-1...a1a0.a-1a-2... representSumk=-infn(ak*Prodj=1kbj).

(where when k<0, Prodj=1kbj is taken to mean Prodj=k+10bj-1)

Then, we can represent every real number uniquely, up to the usual problem where every terminating representation also has a non-terminating counterpart.

I'm sure it's possible to be even more general and still have unique representations, but it sounds annoying.

Jerry Bona wrote:The Axiom of Choice is obviously true; the Well Ordering Principle is obviously false; and who can tell about Zorn's Lemma?

Blagh this is starting to go way over my head the moment you start using capital pis. What I meant was there are irrationals in base 10 that are still irrationals, but transcendentals that are repeating. Which is obviously weird.

Geekthras wrote:Blagh this is starting to go way over my head the moment you start using capital pis. What I meant was there are irrationals in base 10 that are still irrationals, but transcendentals that are repeating. Which is obviously weird.

The capital pi is the same idea as sigma-notation; but instead of addition, it's multiplication.

Axman: That, and have you played DX 10 games? It's like having your corneas swabbed with clits made out of morphine.Pathway: cocks cocks cocks

Geekthras wrote:Blagh this is starting to go way over my head the moment you start using capital pis. What I meant was there are irrationals in base 10 that are still irrationals, but transcendentals that are repeating. Which is obviously weird.

You could say that this base is, in a way, designed to make e act like that since e is the reciprocal sum of the factorials. If you try to represent pi in this base, You'll notice that it looks just as random as it's interpretation in base 10.

EDIT: A good example I just came up with is a base of the square numbers, where 2 would be represented as 10S, or 1*22 + 0*11 and 120S would be 1*32+2*22 + 0*11, or 1310. If you extend this concept to decimals, then 0.1111111111...S is equal to π2/6 and 0.666666666...S is equal to π2

Right. Even if you understand and can prove the math behind it, the idea of being able to represent e as .111111... in any base is just wrong, just as epii+1=0 is just wrong. Same with the birthday paradox, or the x/2 3x+1 problem.

Geekthras wrote:Right. Even if you understand and can prove the math behind it, the idea of being able to represent e as .111111... in any base is just wrong, just as epii+1=0 is just wrong. Same with the birthday paradox, or the x/2 3x+1 problem.

Wrong as in "That's just wrong... His head shouldn't turn that way." I thought that it was a widely used colloquialism (is that even a word?) but it might be regional like "anyways."

Back to factoriary or factoriadic or whatever numbers,

Okay, so now I understand the big pi notation. This makes much more sense to me now. Division tests could be very odd. EX for 3, if the 2's and 1's digits are 00 or 11, then it is divisible2: 1's digit=03: 2's,1's=00,115: 24,6,2,1=0000, 0021, 0122, 0221...Wonder if you could find patterns

CodeLabMaster wrote:EDIT: A good example I just came up with is a base of the square numbers, where 2 would be represented as 10S, or 1*22 + 0*11 and 120S would be 1*32+2*22 + 0*11, or 1310. If you extend this concept to decimals, then 0.1111111111...S is equal to π2/6 and 0.666666666...S is equal to π2

It's all good, except 22=4, not 2. 0-3 would be represented the same as they are in decimal, 4 would be 10S, 8 would be 20S, 9 would be 100S, 15 would be 112S, 16 would be 1000S, 24 would be 1020S, etc.

A casual glance at the pattern here seems to indicate that base 2 requires four distinct digits to represent any whole number. There is a problem in that there are whole numbers with multiple terminating representations in base 2. E.g. 1100 =S 10000 (which is really only saying a2+b2=c2 has the particular solution a=3, b=4, c=5). Actually, that (plus a small bit of work) is enough to show that any whole number can be represented in the base of square numbers using only four digits.

Now I see this has been discussed already in this discussion. One person wrote:

"I'm sorry, but a positional numeral system which needs a different symbol for every whole number is worthless as a positional numeral system."

This is an error. It may be unwieldy for practical purposes. I'll leave that to the forum on common sense.

But for theoretical purposes, there are lots of interesting questions one might ask. Factorial base is particularly nice in pure math because. like continued fractions, it doesn't depend on any arbitrary choice of base.

E.g., we get:

sqrt(2) - 1 = 0 2 1 4 4 1 5 0 8 1 11 1 7 8 4 11 13 . . .

sqrt(½) = 1 1 0 4 5 0 6 4 9 0 11 7 3 11 10 2 2 5 16 . . .

pi - 3 = 6 0 3 1 5 6 5 0 1 4 7 8 0 6 7 10 7 10 4 . . .

Hmm: "7 10 7 10" -- can that just be a coincidence (:-)> ?

And for practical purposes, it was pretty easy to write the (Mathematica) program that computed these.

Geekthras wrote:Correct me if I'm wrong, but in this system, wouldn't 1.111...... be e?

I believe so.

3.

skeptical scientist wrote:But wouldn't you need infinitely many different symbols for single digits?

Technically, yes. But there are workarounds. Example: Treating [1015] or a similar construct as a single digit, or using the representation xyz used above, etc.

Striving for neutral good while caught in the crossfire of a struggle between lawful stupid, chaotic stupid, and, on occasion, just plain stupid.Yeah, I'm wearing groucho glasses over a ninja mask. You have a problem with that?