Skip to main content

arithmetic_nth_term

Function arithmetic_nth_term 

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

Returns the zero-based indexth term of an arithmetic progression.

§Errors

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

§Examples

use use_series::arithmetic_nth_term;

assert_eq!(arithmetic_nth_term(3, 2, 4)?, 11);