Research‎ > ‎

Factorials

The factorial of a given number is that given number times itself minus one, times itself minus two, all the way down to one. So the factorial of five is 5 * 4 * 3 * 2 * 1, while the factorial of one is 1. When using the factorial of a number, it is customary to write that number, then a "!" directly after, so the factorial of five can be written like this: 5!, and the factorial of one like this: 1!. Factorials are not used vary much, besides in probability in statistics and Taylor functions in calculus. There is currently many methods to solve factorials; some are more accurate or faster then others. First, I will show you an efficient way to half the amount of multiplying that you have to do in a factorial, then I will show you how to fourth the multiplying. I would not recommend finding the factorial using only a fourth of the multiplication to most readers, because it is extremely intensive. Now, to the numbers.
 
To half the multiplication with even numbers, you will end up with the number, divided by two, factors. The first factor will be the number you are taking the factorial of, then the next will be that number plus that number minus two. The next number will be the previous number plus the lasted added number minus two. You are done when the last number you added was two. That probably didn't make much sense, so let me give you an example.
 
8! = 8 * (8 + 6 = 14) * (14 + 4 = 18) * (18 + 2 = 20)
8! = 8 * 14 * 18 * 20
 
Note that I started with 8, then the first number I added was 6, then 4, then 2, each number added being two less then the number added before it. This method is equivalent to multiplying the least numbers with the greatest numbers, just with less multiplication, like so:
 
8! = 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8
8! = (1 * 8) * (2 * 7) * (3 * 6) * (4 * 5)
8! = 8 * 14 * 18 * 20
 
But what if the number is odd? If the number is odd, the adding is the same, as in you subtract two each time, but you stop at three. The number of factors however changes. If you divide the number by two, you will end up with some number ending in point five. The reason is that if we times the ends together, that we are left with the middle number. Basically, this can all be solved by solving for the number divided by two, rounded down to the nearest whole number, factors and then adding another factor to our list of factors that is equivalent to the number divided by two, rounded up. This probably didn't make much sense either to minds without a mathematical background, so let me do an example:
 
9! = 9 * (9 + 7 = 16) * (16 + 5 = 21) * (21 + 3 = 24) * (roundUp(9/2) = 5)
9! = 9 * 16 * 21 * 24 * 5
 
Note that if we wrote out every number from nine to zero, that five would be in the middle. If you don't like this method, you could also just take the factorial of the even number before the odd (eight in this case) and times it by the odd number (i.e. 9! = 8! * 9).
 
Awesome! So that's how you solve a factorial doing only half of the multiplication. Now onto doing factorials with a fourth of the multiplication. Before I get to in depth, let me warn you now. This method is not for the faint in math, or heart for that matter. To begin, let me introduce some new terms and types of functions that I came up with.
 
The tree is the number that you are taking the factorial of. This means that the if I see "5!" that the tree is "5."
branch is a list of products of the least numbers and the greatest numbers in another list, or a list of every number up to a given number (the definition of a factorial), with the smallest numbers first.
A leaf is a list of differences of one number to the next in another list, when the differences are not zero.
A stem is the first number of a leaf, or branch.
The root is the factorial of the tree.
 
Lets run through an example to solidify these definitions in our mind.
 
Tree: 8
---Branch 1: 1, 2, 3, 4, 5, 6, 7, 8 (Stem = 1)
------Leaf 1: 1, 1, 1, 1, 1, 1, 1 (Stem = 1)
---Branch 2: 8, 14, 18, 20 (Stem = 2)
------Leaf 1: 6, 4, 2  (Stem = 6)
------Leaf 2: 2, 2 (Stem = 2)
---Branch 3: 160, 252 (Stem = 160)
------Leaf 1: 92 (Stem = 92)
---Root:  40320
 
Phew, that was a lot of numbers. If you will notice, most people find the root by multiplying the first branch of the tree together, I earlier showed you how a shortcut to the second branch, and now I will be showing you a shortcut to the third branch. It is important to note that as the tree gets bigger, so does the number of values in the branches; and likewise, the number of branches themselves. At this point I would like to give another vocabulary word and point out that in factorials, the first, second, and third branches all have a leaves, the last of which always ends a list of the same number repeated a couple times. I call the number that the last branch solely consists of repetitions of the essence of that branch.
 
To help us solve for the third branch, we will have to know how to solve branches given stems. The process is like solving a table, and is like functions in the respect that the x value is the position in the branch, and the y value is the value at that x position in the branch. To do this method, you need the stem of the branch you want to solve, and the stem of every leaf of that branch, up until the essence of the branch. Then, you take the stem of the branch, add the stem of the first leaf to it, and you have your second value in your branch. Then you take the stem of the third branch, and add it to the stem of the first leaf, to get the second value in the first leaf. Then you add the second value in the branch to the second value in the first leaf to get your third value in your branch. You repeat this until you have solved for as many values as you need from the branch. Note that if you run out of stems, just use the essence of the branch. Let me solve this random branch.
 
The branch stem is: 129
The leaf stems are: 284, 84, 24
With an essence of 24.
 
 129  (129+284) = 413  (413+368) = 781  (781+476) = 1257  (1257+608) = 1865  (1865+764) =2629
 284 (284+84) = 368  (368+108) = 476  (476+132) = 608  (608+156)  = 764  
 84 (84+24)  = 108  (108+24)   = 132  (132+24) = 156    
 24  24  24      
 
That was lots of addition! These tables for solving branches using stems are the KEY STONE to solving the third branch. If there is great enough demand expressed to me, I will make a YouTube video demonstrating how to do these in real time, and elaborate on them more here. For now, I'm moving on.
 
Before we go waist deep into the river, lets get our toes wet. I'm going to  explain the general process of solving for the third branch of a tree. First, you can only use this method on even trees. To find an odd tree, just find the factorial of the even before and times it by the odd tree. The number of values in the third tree that is inside the third tree is the tree divided by four. Note that this means that every other even number you will get a number ending in point five. If this happens, round down to the nearest whole number and add the tree divided by four rounded up, times that number plus the tree divided by two. There is a explanation for this, but trust me on this one, you don't want to know. If you really can't live without it, call me.
 
Now that we have a nice even number of values to solve for, lets solve them! To find the values, we have to create a branch-stem table for each value, and solve it for the correct value. These table happen to always have three stems and an essence. But where do we get the stems and the essence for branch-stem tables from? Well, we could memorize the stems for each value, but how many stems and essences would we need to memorize, especially if we started getting thousands of values in the third branch? That just wouldn't be feasible, so I came up with three branch-stem tables that each yield a stem to a branch-stem of a value, and a method to find the essence of the branch-stem of the value.
 
Well that's the theory. If you don't understand, don't worry, I will show an example later. For now, lets learn the stems of the branch-stem tables for solving the stems of the branch-stem tables of the values. Note that the last leaf in the branch-stem tables have two numbers, that's because the leafs are not purely the essence, but have a stem of the first number, then consist of the second number (the essence) from then on out.
 
Stem1
 Stem2  Stem3
 160  140  64
 92  112  60
 736  356  68, 44
 476  16, 108  
 352, 216    
 
Essence = position-of-value-in-third-branch * 12
 
Now that we know these things we can solve for any value in the third branch of any tree. Let me run through an example. Lets find every value in the third branch of eighteen.
 
Tree = 18
Branch3 = { }
 
Number of values in Branch3 = 18/4 = 4.5
 
This means that we will need to add 18 divided by 4 rounded up, times that number plus 18 divided by 2, which is 5 times 14, and that equals 70. Remember 70, we will add it to our list of factors at the end. Now, we need to solve for the other four values in the third branch, and to do this we need the all the stems and essences of the branch-stem tables for each of the four values. Lets solve the three branch-stems given above to find the stems. Note that I will insert numbers between the table name and the branch.
 
 Stem1     Stem2     Stem3   
 1 2 3 4  1 2 3 4  1 2 3 4
 160 252 1080 3120  140 252 720 1560  64 124 252 424
 92 828 2040   112 468 840   60 128 172 
 736 1212    356 372    68 44  
 476     16 108       
 352 216            
Okay, now lets put those together for the branch-stem tables of the values. Note that the essence is just the position of the value in the third branch times twelve, as mentioned above. I would also like to stop here for an observation. The tables are titled according to the stem it solves for, and the numbers directly below that are the markers for what value the stem is in. For example, the first stem of the second value would be 252, and the third stem of the fourth value would be 424.
 
Below are the table constructed with the values. The tittles are what value they solve for, and the numbers below that are the numbers corresponding to the tree you're currently trying to solve. We are trying to solve for the 18'th tree, so be will be looking for a value under the number 18. Note that the values are incremented by two, and that the first value's table always starts with eight, and with every value's table after that, it starts with the value's position times 3. Once again, we are looking under the value of our tree, 18.
 
 Value1     
 (8) (10) (12) (14) (16) (18)
 160 300 504 784 1152 1620
 140 204 280 368 468 
 64 76 88 100  
 12 12 12   
 Value2     
 (8) (10) (12) (14) (16) (18)
 252 504 880 1404 2100 2992
 252 376 524 696 892 
 124 148 172 196  
 24 24 24   
 Value3   
 (12) (14) (16) (18)
 1080 1800 2772 4032
 720 972 1260 
 252 288  
 36   
 Value4 
 (16) (18)
 3120 4680
 1560 
 424 
 48 
 
So there you have it. Our four factors are 1620, 2992, 4032, and 4680. But don't forget, we also have to add 70 to that list because eighteen divided by four is four point five. I explained how we determined it was seventy that we needed to add on above. So our complete list is 70, 1620, 2992, 4032, and 4680. Here are the results:
 
18! = 18 * 17 * 16 * 15 * 14 * 13 * 12 * 11 * 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1
18! = 6.40237370573E15
 
18! = 70 * 1620 * 2992 * 4032 * 4680
18! = 6.40237370573E15
 
Wow, but that was a lot of work to get that third branch. I wouldn't recommend using this in many things, unless you can't run the factorial of a large number by conventional means on a computer, and have to use another method. Another note about this method is that it is possible to use it for odd trees, but it is much easier to just figure the factorial of the even tree before it and times it by the odd tree.
 
So, in conclusion, the first method I showed you for finding the first branch was much more efficient by replacing a multiplication problem with a one addition and one subtraction problem, effectively halving the work to find a factorial, and the second method I showed you to find the third branch was extremely inefficient. I hope you learned something from this, and may be able to use the first method I showed you in your math.
 
If you have any questions, or concerns please send me an email, otherwise, please feel free to comment below! Thanks for reading!

Update: Please note that there is a more efficient way to find the third branch. I'm currently working on this. If you check back in a couple days, I should have it up.
Comments