public static int FibonacciSum(int n) {
if(n == 1) {
return 2;
}
int sum = 0;
int fenmu = 1, fenzi=2,sn =0 ;
for(int i=1;
i<=n;
i++) {
sum += fenzi/fenmu;
sn = fenzi+fenmu;
fenmu = fenzi;
fenzi = sn;
}
return sum;
}
【求一个分数2/1|求一个分数2/1, 3/2, 5/3, 8/5...前n项序列之和】