Function: geometricSequence()
ts
function geometricSequence(
firstTerm,
commonRatio,
numberOfTerms): number[];Generates a geometric sequence. 生成等比数列。
Parameters
| Parameter | Type | Description |
|---|---|---|
firstTerm | number | The first term / 首项 |
commonRatio | number | The common ratio / 公比 |
numberOfTerms | number | The number of terms / 项数 |
Returns
number[]
An array containing the geometric sequence / 包含等比数列的数组
Example
typescript
geometricSequence(2, 3, 5) // => [2, 6, 18, 54, 162]
geometricSequence(1, 0.5, 4) // => [1, 0.5, 0.25, 0.125]Since
1.0.0