Skip to main content

geometric_nth_term

Function geometric_nth_term 

pub const fn geometric_nth_term(
    first: i128,
    ratio: i128,
    index: u64,
) -> Result<i128, SeriesError>
Expand description

Returns the zero-based indexth term of a geometric progression.

§Errors

Returns SeriesError::Overflow when the resulting term does not fit in i128.

§Examples

use use_series::geometric_nth_term;

assert_eq!(geometric_nth_term(2, 3, 4)?, 162);