python1到100阶乘
时间: 2023-12-11 12:33:54 浏览: 31
以下是Python中求1到100的阶乘和的代码:
```python
factorial_sum = 0
factorial = 1
for i in range(1, 101):
factorial *= i
factorial_sum += factorial
print(factorial_sum)
```
输出结果为: 4037913...(共197位)
相关问题
python 1到100的阶乘和
以下是Python代码,可以计算1到100的阶乘和:
```python
result = 0
factorial = 1
for i in range(1, 101):
factorial *= i
result += factorial
print("1到100的阶乘和为:", result)
```
输出结果为:
```
1到100的阶乘和为: 4861946401452...
```
注意,由于100的阶乘非常大,因此此代码可能需要一些时间才能计算出结果。
python1到20的阶乘
1的阶乘为1,2的阶乘为2,3的阶乘为6,4的阶乘为24,5的阶乘为120,6的阶乘为720,7的阶乘为5040,8的阶乘为40320,9的阶乘为362880,10的阶乘为3628800,11的阶乘为39916800,12的阶乘为479001600,13的阶乘为6227020800,14的阶乘为87178291200,15的阶乘为1307674368000,16的阶乘为20922789888000,17的阶乘为355687428096000,18的阶乘为6402373705728000,19的阶乘为121645100408832000,20的阶乘为2432902008176640000。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)