正整数的阶乘 位数大于等于 1000 的第一个正整数是?

def factorial_me(n):
    '''建立求阶乘的函数'''
    result = 1
    for i in range(2, n + 1):
        result = result * i
    return result
n=1
while True:
    v=factorial_me(n)
    str1=str(v)
    if len(str1)>=1000:
        print(n)
        break
    n+=1

在这里插入图片描述

发布了51 篇原创文章 · 获赞 5 · 访问量 2134

猜你喜欢

转载自blog.csdn.net/weixin_44659084/article/details/103745141
今日推荐