| 
December 25th, 2006, 11:56 AM
| | | factorial for big numbers I need a way to find factorail for big numbers like 8479!
Thanks in advance
raju | 
December 25th, 2006, 12:01 PM
|  | Global Moderator | | Join Date: Nov 2005 Location: New York City
Posts: 11,186
Country: Thanks: 482
Thanked 3,758 Times in 3,070 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. | 
December 25th, 2006, 12:48 PM
|  | Grand Panjandrum | | Join Date: Nov 2005 Location: South of England
Posts: 11,379
Country: Thanks: 667
Thanked 3,619 Times in 2,916 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
__________________ Truth does not change because it is, or is not, believed by a majority of the people.
Giordano Bruno | 
December 25th, 2006, 01:19 PM
|  | Global Moderator | | Join Date: Nov 2005 Location: New York City
Posts: 11,186
Country: Thanks: 482
Thanked 3,758 Times in 3,070 Posts
| | Quote:
Originally Posted by CaptainBlank See Stirlings formula (equations 13 and 14 here)
RonL | That is only an approximation. | 
December 25th, 2006, 03:02 PM
|  | Grand Panjandrum | | Join Date: Nov 2005 Location: South of England
Posts: 11,379
Country: Thanks: 667
Thanked 3,619 Times in 2,916 Posts
| | Quote:
Originally Posted by ThePerfectHacker That is only an approximation. | How many digits does 8479! have?
(Rhetorical question)
RonL
__________________ Truth does not change because it is, or is not, believed by a majority of the people.
Giordano Bruno | 
December 25th, 2006, 04:52 PM
|  | Eater of Worlds | | Join Date: Jul 2006 Location: Chaneysville, PA
Posts: 2,876
Country: Thanks: 121
Thanked 1,104 Times in 992 Posts
| | Quote:
Originally Posted by CaptainBlack How many digits does 8479! have?
(Rhetorical question)
RonL | Over 29,000.
25972686487041052159869258722936182200373790277711 48344797668281885988268302193747006721558615751528[...29429 digits...]00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 | 
December 25th, 2006, 05:45 PM
|  | Global Moderator | | Join Date: Nov 2005 Location: New York City
Posts: 11,186
Country: Thanks: 482
Thanked 3,758 Times in 3,070 Posts
| | Quote:
Originally Posted by CaptainBlack How many digits does 8479! have?
(Rhetorical question)
RonL | I can find how many zeros is has  . | 
January 29th, 2007, 06:08 AM
| | Member | | Join Date: Nov 2006 Location: oxford
Posts: 118
Country: Thanks: 57
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 | 
March 12th, 2007, 05:47 PM
| | Newbie | | 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) | 
March 12th, 2007, 11:05 PM
|  | Grand Panjandrum | | Join Date: Nov 2005 Location: South of England
Posts: 11,379
Country: Thanks: 667
Thanked 3,619 Times in 2,916 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
__________________ Truth does not change because it is, or is not, believed by a majority of the people.
Giordano Bruno | 
March 12th, 2007, 11:17 PM
| | Newbie | | Join Date: Mar 2007
Posts: 7
Country: Thanks: 0
Thanked 0 Times in 0 Posts
| | Quote:
Originally Posted by CaptainBlack How does this relate to finding the factorial of a large number?
RonL | it gives the base of a number in its prime factors,
then u can use all of theose prime numbers in different combinations to find the factors | 
March 13th, 2007, 12:05 AM
|  | Grand Panjandrum | | Join Date: Nov 2005 Location: South of England
Posts: 11,379
Country: Thanks: 667
Thanked 3,619 Times in 2,916 Posts
| | Quote:
Originally Posted by spanner it gives the base of a number in its prime factors,
then u can use all of theose prime numbers in different combinations to find the factors | This is incomprehensible, please give us an example
RonL
__________________ Truth does not change because it is, or is not, believed by a majority of the people.
Giordano Bruno | 
March 13th, 2007, 08:22 AM
| | Member | | Join Date: Nov 2006 Location: oxford
Posts: 118
Country: Thanks: 57
Thanked 15 Times in 15 Posts
| | hang on maybe some confusion. spanner were finding a method of carrying out the factorial function not the LCM. I dont see how in anyway ur method can find the factorials of large numbers. | 
March 14th, 2007, 02:55 AM
|  | Grand Panjandrum | | Join Date: Nov 2005 Location: South of England
Posts: 11,379
Country: Thanks: 667
Thanked 3,619 Times in 2,916 Posts
| | Quote:
Originally Posted by chogo hang on maybe some confusion. spanner were finding a method of carrying out the factorial function not the LCM. I dont see how in anyway ur method can find the factorials of large numbers. | I think that is what I was trying to indicate, indirectly so as not to cause offence  .
RonL
__________________ Truth does not change because it is, or is not, believed by a majority of the people.
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 12:59 PM. | | |