factorial...

Paul Chamberlain tif at doorstop.austin.ibm.com
Fri Feb 8 01:55:07 AEST 1991


josevela at mtecv2.mty.itesm.mx (Jose Angel Vela Avila) writes:
> We are having trouble trying to do the factorial of 10000 :-)

I don't know if the smiley makes this a joke or not but I can't resist
a challenge.  A RISC System/6000 Model 930 running bc did this in:
	real	14m25.13s
	user	14m10.08s
	sys	0m3.46s
and came up with 35660 digits, available if you really want them.  Here
is the bc program just in case you're curious.
	define f(n) {
		auto x
		x = 1
		for (n; n>1; n--) {
			x = x * n
		}
		return(x)
	}
	f(10000)
	quit

Paul Chamberlain | I do NOT speak for IBM.          IBM VNET: PAULCC AT AUSTIN
512/838-9662     | ...!cs.utexas.edu!ibmchs!auschs!doorstop.austin.ibm.com!tif



More information about the Comp.unix.programmer mailing list