🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.misc
Article #56

Re: Tough FACTORIAL math problem...

#56
From: Andrew Koenig
Date: Wed, 14 Feb 1996 15:19
22 lines
1221 bytes
In article <4fr8be$ass@news.iconn.net> thecrow@iconn.net (The Crow) writes:

> Here is what I am trying to do, I want to find the last NON-ZERO digit of a 
> given factorial.  For instance,

> 5! = 120

> so the last non-zero digit is 2.  I want to be able to do this up to 1000.  
> Problem is, no matter how huge of a data-type you use, there isn't any way for 
> the computer to handle 1000!,

Sure there is.  Lots of people have written programs to do
arbitrary-precision integer arithmetic.

But a few minutes of thought convinced me that the problem
you pose can be solved very easily, without arbitrary precision
arithmetic.  I would tell you how to do it, but the problem
looks like a homework assignment and I don't want to contribute
to academic plagiarism.
-- 
				--Andrew Koenig
				  ark@research.att.com
Technical Details
Message-ID: <DMruKv.CCp@research.att.com>
Path: arc1-ca.pugleaf.net!in2.uu.net!allegra!alice!ark
References: <4fr8be$ass@news.iconn.net>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.pascal.misc,comp.lang.c++,comp.lang.c,comp.lang.pascal.borland
Path: arc1-ca.pugleaf.net!in2.uu.net!allegra!alice!ark
From: ark@research.att.com (Andrew Koenig)
Subject: Re: Tough FACTORIAL math problem...
Message-ID: <DMruKv.CCp@research.att.com>
Organization: AT&T Research, Murray Hill NJ
References: <4fr8be$ass@news.iconn.net>
Date: Wed, 14 Feb 1996 15:19:43 GMT