a discrepancy concerning A063979

Robert Gerbicz robert.gerbicz at gmail.com
Tue Jul 8 14:04:37 CEST 2008


2008/7/8 N. J. A. Sloane <njas at research.att.com>:

> Dear Sequence Fans, At present the entry reads as follows:
>
> %I A063979
> %S A063979 1,1,1,3,24,199,1747,16474,168187,1859934,22228104,286078171,
> %T A063979
> 3949867548,58284826485,915905054360,15276520209206,269617872744249,
> %U A063979 5021159048900643,98417586560408168,2025488254833817394
> %N A063979 Number of decimal digits in (n!)!; A000197.
> %H A063979 Eric Weisstein's World of Mathematics, <a href="
> http://mathworld.wolfram.com/Factorial.html">Factorial</a>
> %p A063979 seq(length((n)!!), n=0..19); - Zerinvary Lajos
> (zerinvarylajos(AT)yahoo.com), Mar 10 2007
> %t A063979 Do[ Print[ Floor[ N[ Log[10, (n!)! ], 24] + 1]], {n, 0, 11} ]
> %Y A063979 Cf. A000197, A063944, A034886.
> %K A063979 base,nonn
> %O A063979 0,4
> %A A063979 Robert G. Wilson v (rgwv(AT)rgwv.com), Sep 05 2001
> %E A063979 More terms from Vladeta Jovovic (vladeta(AT)Eunet.yu), Sep 06
> 2001
>
> Dmitry Kamenetsky (dkamen at rsise.anu.edu.au), Jul 08 2008 says:
>
> %C A063979 for n=17, 18 and 19 I get 5021159048900644, 98417586560408160
> and 20254882548338170
> 88 respectively. This is slightly different to the quoted numbers. Can
> someone please verify t
> his?
>
> %o A063979 Here is my Python program:
>
> from math import sqrt, pi, log, e, floor
>
> def fact(n):
>       r = 1
>       for i in xrange(2, n+1):
>               r = r * i
>       return r
>
>
> def fact2(n):
>
>        n=fact(n)
>        b=(log(2*pi)+log(n))/2+(log(n)-1)*n
>        digits = int(floor(b/log(10)) + 1)
>        return digits
>
>
> for n in xrange(1,20):
>        print n,fact2(n)
>
> (end of quote)
>
> Which version is correct?
>
> Thanks
> Neil
>
>
The original version is good. I've checked it by the following PARI-Gp
program, using 40 digits precision is more than enough.

f(n)=a=n!;return(floor((a*log(a)-a+1/2*log(2*Pi*a)+1/(12*a))/log(10)+1)

I think the different answer is due to the precision in Python.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.seqfan.eu/pipermail/seqfan/attachments/20080708/ade02b01/attachment-0001.htm>


More information about the SeqFan mailing list