📜  gp 的第 n 项 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:14.780000             🧑  作者: Mango

代码示例1
The nth term of a GP is Tn = arn-1. Common ratio = r = Tn/ Tn-1. The formula to calculate the sum of the first n terms of a GP is given by: Sn = a[(rn-1)/(r-1)] if r ≠ 1and r > 1. Sn = a[(1 – rn)/(1 – r)] if r ≠ 1 and r < 1.