寻找因子和结束0的高价值。 [英] Finding Factorials and Ending 0's for High Values.

查看:56
本文介绍了寻找因子和结束0的高价值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友您好,

我遇到了问题。我想找到大数字的阶乘。

Ex:1555! =?。

195! =?。

我的主要问题是我想知道阶乘数的结尾0'的确切数字。



我使用以下公式:

(m!)^ n = m! = 2 * 10 ^(n-1)+ 2 ^ 2 * 10 ^(n-2)+ ------- + 2 ^ n。



用这个我可以解决其他因子,结束0'的数量就像这样。



100!= 2 * 10 ^ 1 + 2 ^ 2 * 10 ^ 0 = 20 + 4 = 24

100!按此计算有24个结尾0'。



但是,我还有其他问题,

Ex:95!

i)95! =(100 - 5)! = 24-2 * 5 ^(1-1)= 24-2 = 22 => 95!已经22 0'了。



ii)95! =(90 + 5)! = 9 *(2 * 10 ^ 0)+ 2 * 5 ^ 0)= 18 + 2 = 20 => 95!有20 0'。



这是我的问题。通过使用上面的公式,我得到了两个不同的答案,我很困惑,我没有得到完美的答案所以请帮我找到它。



谢谢...

Hello friends,
I have a problem. I want to find factorial of big numbers.
Ex: 1555! = ?.
195! = ?.
My main problem is that I want to know the exact number of ending 0''s of the factorial numbers.

I use the following formula:
(m!)^n = m! = 2*10^(n-1) + 2^2 * 10^(n-2) + ------- + 2^n.

with this I can solve the other factorials for number of ending 0''s like this.

100!= 2*10^1 + 2^2*10^0 = 20+4 = 24
100! has 24 ending 0''s as per this calculation.

But, then I got other problem,
Ex: For 95!
i) 95! = (100 - 5)! = 24 - 2*5^(1-1) = 24 - 2 = 22 => 95! has 22 0''s.

ii) 95! = (90 + 5)! = 9*(2*10^0) + 2*5^0)= 18+2 = 20 => 95! has 20 0''s.

this is my problem. By using the above formula I got two different answers and I am confused, I don''t get the perfect answer so please help me to find it.

Thank you...

推荐答案

在C中,这并不容易。而且我不知道可用的图书馆;也许别人会为你指出一个。你可以在这里找到一些想法: http:// stackoverflow .com / questions / 3340511 / what-is-the-the-simple-of-implementation-bigint-in-c [ ^ ]。



-SA
In C, this is not so easy. And I don''t know good available library; maybe someone else will point out one for you. You can find some ideas here: http://stackoverflow.com/questions/3340511/what-is-the-simplest-way-of-implementing-bigint-in-c[^].

—SA


这篇关于寻找因子和结束0的高价值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆