| 
12-25-2006, 11:56 AM
| | Newbie | | Join Date: Dec 2006
Posts: 1
Country: Thanks: 0
Thanked 0 Times in 0 Posts
| | factorial for big numbers I need a way to find factorail for big numbers like 8479!
Thanks in advance
raju | 
12-25-2006, 12:01 PM
|  | Global Moderator | | Join Date: Nov 2005 Location: New York City
Posts: 11,339
Country: Thanks: 329
Thanked 2,943 Times in 2,472 Posts
| | Quote:
Originally Posted by raju I need a way to find factorail for big numbers like 8479!
Thanks in advance
raju | A simple way.
Just multiply them out.
__________________ We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America. | 
12-25-2006, 12:48 PM
|  | Grand Panjandrum | | Join Date: Nov 2005 Location: Somewhere near the south coast
Posts: 10,104
Country: Thanks: 472
Thanked 2,599 Times in 2,162 Posts
| | Quote:
Originally Posted by raju I need a way to find factorail for big numbers like 8479!
Thanks in advance
raju | See Stirlings formula (equations 13 and 14 here)
RonL
__________________ "It is proof of a base and low mind for one to wish to think with the masses or majority, merely because the majority is the majority"
--Giordano Bruno | 
12-25-2006, 01:19 PM
|  | Global Moderator | | Join Date: Nov 2005 Location: New York City
Posts: 11,339
Country: Thanks: 329
Thanked 2,943 Times in 2,472 Posts
| | Quote:
Originally Posted by CaptainBlank See Stirlings formula (equations 13 and 14 here)
RonL | That is only an approximation.
__________________ We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America. | 
12-25-2006, 03:02 PM
|  | Grand Panjandrum | | Join Date: Nov 2005 Location: Somewhere near the south coast
Posts: 10,104
Country: Thanks: 472
Thanked 2,599 Times in 2,162 Posts
| | Quote:
Originally Posted by ThePerfectHacker That is only an approximation. | How many digits does 8479! have?
(Rhetorical question)
RonL
__________________ "It is proof of a base and low mind for one to wish to think with the masses or majority, merely because the majority is the majority"
--Giordano Bruno | 
12-25-2006, 04:52 PM
|  | Eater of Worlds | | Join Date: Jul 2006 Location: Chaneysville, PA
Posts: 2,443
Country: Thanks: 88
Thanked 844 Times in 761 Posts
| | Quote:
Originally Posted by CaptainBlack How many digits does 8479! have?
(Rhetorical question)
RonL | Over 29,000.
25972686487041052159869258722936182200373790277711 48344797668281885988268302193747006721558615751528[...29429 digits...]00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
__________________
Old mathematicians never die; they just lose some of their functions. | 
12-25-2006, 05:45 PM
|  | Global Moderator | | Join Date: Nov 2005 Location: New York City
Posts: 11,339
Country: Thanks: 329
Thanked 2,943 Times in 2,472 Posts
| | Quote:
Originally Posted by CaptainBlack How many digits does 8479! have?
(Rhetorical question)
RonL | I can find how many zeros is has  .
__________________ We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America. | 
01-29-2007, 06:08 AM
| | Senior Member | | Join Date: Nov 2006 Location: oxford
Posts: 112
Country: Thanks: 47
Thanked 15 Times in 15 Posts
| | i had this problems some weeks back. Stirlings function is probably the best for large factorials. But otherwise use this bit of code i wrote in java which is computationally efficient.
public double gammaln(float xx){
double x,y,tmp,ser;
double[] cof={76.18009172947146,-86.50532032941677,
24.01409824083091,-1.231739572450155,
0.1208650973866179e-2,-0.5395239384953e-5};
int j;
y=x=xx;
tmp=x+5.5;
tmp -= (x+0.5)*Math.log(tmp);
ser=1.000000000190015;
for (j=0;j <= 5;j++) {ser += cof[j]/++y;}
return -tmp+ Math.log(2.5066282746310005*ser/x);}
public double factorial(float n){
double value = gammaln(n + 1);
double answer = Math.exp(value);
return answer;}
This is based around a method of gamma approximation by C.lanczos. (Paper is called - (A precision approximation of the gamma function).
This method can also be used to find NON integer factorials | 
03-12-2007, 05:47 PM
| | Junior Member | | Join Date: Mar 2007
Posts: 7
Country: Thanks: 0
Thanked 0 Times in 0 Posts
| | I think ur asking this for a question like "find the lowest common multiple" (LCM)
there is no need to use massive formulas unless the number is greater then 1trillion. just use Prime factorisation.
eg. 4 = 2 power of 2
6 = 3 x 2
1001 = 7 x 11 x 13
etc...
take the number and find all possible prime numbers which go ito it. (see examples above)
then...
eg. find the lowest common multiple of 4, 2, 6
4 = 2 squared 2 = 2 and 6 = 2x3
therfore the number must contain 2 squared and 3.
= 2 squared x 3
= 12
find all prime factors of the numbers. and take the common ones out
eg. 2 squared and 2
only use 2 squared because 2 is within 2 squared
then multiply them together.
(i can go on but it would just be useless) | 
03-12-2007, 11:05 PM
|  | Grand Panjandrum | | Join Date: Nov 2005 Location: Somewhere near the south coast
Posts: 10,104
Country: Thanks: 472
Thanked 2,599 Times in 2,162 Posts
| | Quote:
Originally Posted by spanner I think ur asking this for a question like "find the lowest common multiple" (LCM) | How does this relate to finding the factorial of a large number?
RonL
__________________ "It is proof of a base and low mind for one to wish to think with the masses or majority, merely because the majority is the majority"
--Giordano Bruno | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -7. The time now is 09:53 AM. | | |