|
|
Subject:
Factorial for large numbers
Category: Science > Math Asked by: tabcity-ga List Price: $25.00 |
Posted:
26 Jun 2002 13:22 PDT
Expires: 26 Jul 2002 13:22 PDT Question ID: 33709 |
I need the factorial value for 83,000 (eighty three thousand) or 83000(!). That is 83000 x 82999 x 82998 x 82997 etc. I prefer answer in the form N.nnn times 10 to the eXponent. If you use a stat program, I need the name of the Stat program used. |
|
Subject:
Re: Factorial for large numbers
Answered By: jeanluis-ga on 26 Jun 2002 15:39 PDT Rated: |
Hello, 83000! = 7.91222558e372239 Note: because you wanted it in exponential notation it is an approximate value, the actual value would take a few thousand lines in this message box, but I can post it if you want it, or you can do it yourself with the instructions below. To figure this out, I used an infinite precision math package written for the Tcl scripting language called Mpexpr. I had this already installed on my computer so I just wrote a small program that computed this value, here is the program: package require Mpexpr set factorial [mpformat "%e" [mpexpr fact(83000)]] And that is all there is to it (I say that as if it were nothing, but in fact it took almost 30 minutes to compute the factorial and format it on my computer). To run the factorial, assuming you have Tcl and Mpexpr installed on your system (if you don't have them, I have included instructions below), you would execute the main tcl (tclsh) executable. It will give you a prompt that looks like this: % then you just type in those 2 lines above, and it computes the factorial for you, and formats it in exponential notation. If you don't have Tcl and Mpexpr installed on your system then you can download them and install them from the following websites, they are both freely available: To get Tcl installed you should goto the Tcl website: "Tcl 8.0" http://www.scriptics.com/software/tcltk/8.0.html#Download Binary Simply download the Windows Tcl self-extracting installer, and run the tcl805.exe file. That should install Tcl. To get the Mpexpr package installed do the following: "Mpexpr download" http://www.NeoSoft.com/tcl/ftparchive/sorted/math/Mpexpr-1.0/1.0/mpexpr-1.0.tar.gz The once you download the Mpexpr package you can unzip it using any zip utility (WinZip, PkZip, etc...) and then you should goto the mpexpr-1.0\win directory, and read the README.win file, it will tell you how to complete the install. "Some information about Mpexpr" http://www.nyx.net/%7Etpoindex/tcl.html#Mpexpr Hope this works for you, feel free to ask for more info. | |
| |
|
tabcity-ga
rated this answer:
Excellent! That is exacly what I was looking for. I will add a comment later to show you-all what I needed it for. Thanks, Jean Luis! |
|
Subject:
Re: Factorial for large numbers
From: ake-ga on 26 Jun 2002 15:44 PDT |
The standard trick is to use the logaritm in base 10. Let x = lg(8600!). Since lg(xy)=lg(x)+lg(y) you have x = sum(lg(k),k=1..86000) Define floor(x) as the integer part of x. Then 86000! = 10^(x-floor(x))*10^floor(x). You can evaluate x to the degree of accuracy you want, for example, using Maple I got: 86000! = 7.91222558*10^372239 The compuation time was close to 0. Sincerely, ake-ga |
Subject:
Re: Factorial for large numbers
From: phiham-ga on 26 Jun 2002 16:55 PDT |
If you like C++, try this: http://www.codeguru.com/algorithms/factorial.shtml Kinda slow though. Change the line near the end from cout<<"E"<num-1<endl; to cout<<"E"<<num-1<<endl; |
Subject:
Re: Factorial for large numbers
From: chinaski-ga on 26 Jun 2002 19:52 PDT |
Or, if you are really lazy, you can just use Stirling's famous approximation ln(z!) ~= (1/2)*ln(2*pi) + (z + 1/2)*ln(z) - z which gives z! = 7.91221e372239. Not perfect, but pretty good for a short formula you can type into any $3 calculator. chinaski-ga |
Subject:
Re: Factorial for large numbers
From: zhiwenchong-ga on 26 Jun 2002 21:55 PDT |
This is extremely clever and simple! Thanks for posting! |
Subject:
Re: Factorial for large numbers
From: arrakis-ga on 27 Jun 2002 12:16 PDT |
Using Mathematica 4, I typed in Timing[NSolve[73000!]] After 1.061 seconds I am provided with the answer. (No arbid digits of precision, mind you. The number was displayed in its entirety) In case it helps, I've posted it on my site. Be warned: its a 330 kb large text file so that is one HUGE number. The URL is: http://www.geocities.com/aatishb/73000.txt Hope this helps! regards Aatish |
Subject:
Re: Factorial for large numbers
From: arrakis-ga on 27 Jun 2002 12:24 PDT |
Oops! I accidently uploaded 73K! instead of 83K. This time it took 1.342 seconds. new URL is: http://www.geocities.com/aatishb/83000.txt apologies Aatish |
Subject:
Re: Factorial for large numbers
From: ake-ga on 27 Jun 2002 16:40 PDT |
time(83000!) in Maple returned the answer 5.280s on an 1GHz P3 with a few background jobs running. Mathematica probably has a faster implementation of the factorial. I don't know how they compute it though; can anyone dig up some info on that? Sincerely, ake-ga |
Subject:
Re: Factorial for large numbers
From: secret901-ga on 30 Jun 2002 21:36 PDT |
Mathematica uses "Adamchik techniques" formulated by Dr. Victor Adamchik, http://www-2.cs.cmu.edu/~adamchik/ using simplified "generalized hypergeometric functions." |
Subject:
Re: Factorial for large numbers
From: gmac-ga on 08 Aug 2002 09:00 PDT |
All the ways of computing the large factorial are interesting, but jeanluis-ga was asking for the wrong computation given the probability desired. Let's consider the probability of the monkeys randomly typing the short sonnet of 611 characters. I think we'd call it close enough if the moneys got the letters and spaces right even if they missed punctuation and case. So for each character position there are 26 letters + 1 spce possibilities. The possible 611 character (counting space as a character) sonnets with this alphabet is NOT 611! but is instead 27^611 = 1.3534 x 10^946. Not likely to hit the one sonnet exactly in our uiverse's lifetime, but the prospects are much better than the incorrect estimate based on 611! = 5.121 x 10^1438. And 27^83000 is _only_ 1.557 x 10^118803 which is considerably smaller than 83000! reported in the other comments. |
Subject:
Re: Factorial for large numbers
From: tne-ga on 20 Aug 2002 21:14 PDT |
thanks gmac-ga I was going throgh all the answers and could not figure out how factorial and the problem were related. Thanks for clarifying |
Subject:
Re: Factorial for large numbers
From: kerberos-ga on 16 Sep 2002 12:33 PDT |
The STANDARD Windows calculator (option View->Scientific) gives the correct result for the 83000! (7.9122255800425502227407709215684e+372239), after some warnings telling that the "requested operation may take a very long time to complete"... |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |