# Factorial Function by Piyush Goel

- Author:
- Piyush Goel

## Factorial Function by Piyush Goel

we will see how Piyush Goel discovered something while playing with numbers. Here is the story .
One day while sitting idle, and having nothing important to do he was just scribbling on paper. he was writing random numbers and thinking how could link them. To his amazement he discovered this:
he wrote down

**0, 1, 2, 3, 4, 5.**Next to each number he wrote their respective squares, viz.**0,1, 4, 9, 16, 25.**Then start subtracting each successive square from the next bigger square. It looks something like this:**(1-0), (4-1), (9-4), (16-9) and (25-16).**What is the result? he got**1, 3, 5, 7, 9.**Now again subtract each successive number from the next one in the order. We are performing this:**(3-1), (5-3), (7-5) and (9-7).**Surprisingly, he got (2, 2, 2, 2). A 2 in each case. he was amazed and decided to take a step further. This time with cubes. So here go my numbers**0, 1, 2, 3 ,4, 5, 6.**And their respective cubes:**0, 1, 8, 27, 64, 125, 216.**Time to perform first round of successive subtraction, i.e.**(1-0), (8-1), (27-8), (64-27), (125-64) and (216-125). The result: 1, 7, 19, 37, 61, 91.**Second round of successive subtraction as performed earlier:**(7-1), (19-7), (37-19), (61-37) and (91-61).****And this is what he got: 6, 12, 18, 24, 30.****Successive subtraction performed the third time: (12-6), (18-12), (24-18) and (30-24).****And this time he got the result (6, 6, 6, 6).**You see, squaring means ‘to the power 2’ and he got the result 2 after 2 successive subtractions, which is the**value of 2!**Cubing means ‘to the power 3’ and after performing 3 successive subtraction he got 6 in each case which is nothing but the value of 3! He similarly performed with 4th and 5th powers of the first few whole numbers. He was surprised to find the final value of**24 and 120 which are of course the values of 4! and 5!.**It was all right up to 5, but he wanted to go a notch higher and check for 6 just for my personal satisfaction. While doing for 6th power the calculations were massive and numbers so huge that it took him a couple of hours to do his calculations. Just to be sure he also did it for numbers upto 15.**Put 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 and 15 and their respective 6th powers:****0,1,64,729, 4096, 15625, 46356, 11649, 262144, 531441, 1000000, 1771561, 2985984,4826809, 7829536 and 11390625.**He kept on doing successive subtractions till to his contentment he finally got 720 for all which is the value of 6! With little efforts, we can work out algebraic relationship for the above but leave it for some other time.