* Julia Thompson ([EMAIL PROTECTED]) wrote: > If you can get me a program to run it, I could do it here.... Not > sure
5565709! has 35 126 456 digits and took 7 minutes 57 seconds to calculate and write to disk. Don't ask me to calculate that factorial, though, because the last calculation took up about 25% of my RAM, and since the size of the result is going up almost exponentially, the next one would exceed my RAM and start swapping to virtual memory. As long as the calculation is in RAM, the time is going up just barely faster than linearly (1e6! took about 1 minute), but if it starts swapping then I'm sure the time will go up much faster than linearly. As might be expected, the resulting number is not really compressible. Using gzip, I compressed the resulting ASCII file of digits [0-9] to 15 827 771 bytes, a factor of 2.22 compression. Since log2(10)=3.32 bits, we would expect about 8/3.32 = 2.41 compression just by coding the digits efficiently. kernel: linux 2.6.9-1-686-smp language: C++ library: GiNaC http://www.ginac.de/ >cat /proc/cpuinfo: stepping : 9 cpu MHz : 2606.436 cache size : 512 KB physical id : 0 siblings : 2 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr bogomips : 5160.96 > c++ factorial1.cc -o fc1 -lcln -lginac > date; ./fc1 > fout5565709; date Wed Apr 20 06:46:24 EDT 2005 Wed Apr 20 06:54:21 EDT 2005 > wc -c fout5565709 35126452 fout5565709 Program: #include <iostream> #include <ginac/ginac.h> using namespace std; using namespace GiNaC; int main() { ex poly; poly = factorial( 5565709 ); cout << poly ; return 0; } -- Erik Reuter http://www.erikreuter.net/ _______________________________________________ http://www.mccmedia.com/mailman/listinfo/brin-l
