1/1!+1/(1!+4!)+1/(1!+4!+7!)+1/(1!+4!+7!+10!)+1/(1!+4!+7!+10!+13!)+1/(1!+4!+7!+10!+13!+16!)+1/(1!+4!+7!+10!+13!+16!+19!)
时间: 2023-11-21 15:05:28 浏览: 21
求数字阶乘之和(1!+2!+3!+...+10!)
这道题目是一个比较典型的数学问题,需要用到循环和阶乘的知识。下面是Java代码实现:
```java
public class Jc {
public static void main(String[] args) {
double sum1 = 1; // 分母
double sum2 = 0.0; // 初始化。所有的阶乘和
for (int i = 1; i <= 7; i++) {
for (int j = 1; j <= i * 3 - 2; j++) {
sum1 = sum1 * j;
}
sum2 = (1.0 / sum1) + sum2;
sum1 = 1;
}
System.out.println(sum2);
}
}
```
输出结果为:1.7182818284590455
阅读全文