Calculate the nth term and the sum of the first n terms of a geometric sequence given the first term and common ratio.
Formula
aₙ = a₁ × r^(n−1), Sₙ = a₁(1−rⁿ)/(1−r)