Geometric Sequence Calculator (Nth Term & Sum)


Geometric Sequence Calculator

Effortlessly calculate the nth term, sum, and visualize any geometric sequence. This tool is perfect for students and developers looking to understand geometric progressions, including how to implement them in C++.



The starting number of the sequence.


The fixed, non-zero number multiplied to get the next term.


The position of the term you want to find (must be a positive integer).

Value of the Nth Term
39366
59048
Sum of First N Terms

2, 6, 18…
Sequence Preview

Chart visualizing the growth of the first 10 terms of the sequence.

What is a Geometric Sequence?

A geometric sequence, also known as a geometric progression, is a sequence of non-zero numbers where each term after the first is found by multiplying the previous one by a fixed, non-zero number called the common ratio. For example, the sequence 3, 6, 12, 24, … is a geometric sequence with a first term of 3 and a common ratio of 2. This concept is fundamental in mathematics and has applications in finance for calculating compound interest, in computer science for analyzing algorithms, and in physics for modeling decay processes. This calculator helps you explore these sequences and can be particularly useful for programmers looking to calculate geometric sequence using given nth term by user in C++. The behavior of the sequence drastically changes based on the common ratio; if it’s greater than 1, the sequence grows exponentially, while if it’s between -1 and 1, it decays towards zero.

The Formula to Calculate the Nth Term

The power of geometric sequences lies in a simple, elegant formula that allows you to find any term without having to calculate all the preceding ones. The explicit formula for the nth term of a geometric sequence is:

an = a · r(n-1)

This formula is the core of our common ratio calculator and is essential for any computation involving these progressions.

Variable Explanations

Variable Meaning Unit Typical Range
an The nth term of the sequence (the value you want to find). Unitless Any real number
a The first term of the sequence. Unitless Any non-zero real number
r The common ratio. Unitless Any non-zero real number
n The position of the term in the sequence. Unitless Positive integer (1, 2, 3, …)

C++ Implementation Example

For developers, implementing a function to find the nth term of a geometric sequence in C++ is a common exercise. It showcases the use of mathematical functions and basic programming logic. Here is a simple, production-ready function to calculate the nth term of a geometric sequence using user-provided values in C++.

#include <iostream>
#include <cmath> // For the pow() function

// Function to calculate the nth term of a geometric sequence
double getNthTerm(double firstTerm, double commonRatio, int n) {
    // The formula is a * r^(n-1)
    return firstTerm * std::pow(commonRatio, n - 1);
}

// Function to calculate the sum of the first n terms
double getSumOfTerms(double firstTerm, double commonRatio, int n) {
    // Special case: if ratio is 1, the sum is just n * a
    if (commonRatio == 1) {
        return firstTerm * n;
    }
    // Standard sum formula: a * (1 - r^n) / (1 - r)
    return firstTerm * (1 - std::pow(commonRatio, n)) / (1 - commonRatio);
}

int main() {
    // User inputs
    double a = 2.0;
    double r = 3.0;
    int n = 10;

    // Calculate the nth term
    double nthTermValue = getNthTerm(a, r, n);
    std::cout << "The " << n << "th term is: " << nthTermValue << std::endl;
    
    // Calculate the sum
    double sum = getSumOfTerms(a, r, n);
    std::cout << "The sum of the first " << n << " terms is: " << sum << std::endl;

    return 0;
}

This code directly translates the mathematical formula into C++, using the `pow` function from the `` library for exponentiation. This approach is efficient and directly mirrors the logic of our calculator. Explore more at our guide on C++ Math Functions.

Practical Examples

Example 1: Exponential Growth

Imagine a startup that doubles its user base every month. If it starts with 500 users, how many users will it have in the 12th month?

  • Inputs: First Term (a) = 500, Common Ratio (r) = 2, Term Number (n) = 12
  • Calculation: 500 * 2(12-1) = 500 * 211 = 500 * 2048
  • Result: The 12th term (a12) is 1,024,000 users. This is a classic use case for the compound interest calculator, which is based on geometric progression.

Example 2: Radioactive Decay

A substance has a half-life of 10 years. If you start with 100 grams, how much will be left after 5 half-life periods (50 years)?

  • Inputs: First Term (a) = 100, Common Ratio (r) = 0.5, Term Number (n) = 6 (n=1 is the start, n=2 is after the first half-life, so n=6 is after 5 periods)
  • Calculation: 100 * 0.5(6-1) = 100 * 0.55 = 100 * 0.03125
  • Result: The 6th term is 3.125 grams.

How to Use This Geometric Sequence Calculator

  1. Enter the First Term (a): Input the starting number of your sequence.
  2. Enter the Common Ratio (r): Input the multiplier between terms. This can be positive, negative, an integer, or a fraction.
  3. Enter the Term Number (n): Specify which term in the sequence you wish to find.
  4. Review the Results: The calculator instantly provides the value of the nth term, the sum of the sequence up to that term, and a visual preview.
  5. Analyze the Chart: The chart dynamically updates to show the trend of your sequence, helping you visualize whether it’s growing, shrinking, or oscillating.

Frequently Asked Questions (FAQ)

What is the difference between a geometric and an arithmetic sequence?
A geometric sequence involves multiplying by a common ratio, while an arithmetic sequence involves adding a common difference. You can explore the latter with our arithmetic sequence calculator.
Can the common ratio (r) be negative?
Yes. A negative common ratio causes the terms of the sequence to alternate in sign (e.g., 2, -4, 8, -16, …). This is a key factor affecting the sequence’s behavior.
What happens if the common ratio (r) is 1?
If r=1, every term is the same as the first term. The sequence is constant (e.g., 5, 5, 5, …). The sum of n terms is simply n * a.
What happens if the common ratio (r) is between -1 and 1?
If |r| < 1, the terms get progressively closer to zero. This is known as a decaying sequence. The sum of such an infinite series converges to a finite value.
How do you find the common ratio?
To find the common ratio, divide any term by its preceding term. For example, in the sequence 2, 6, 18, …, the ratio is 6/2 = 3.
What is the formula for the sum of a geometric sequence?
The sum of the first n terms (Sn) is given by the formula Sn = a(1 – rn) / (1 – r). Our calculator computes this for you automatically.
Can I find a term if I don’t know the first term?
Yes, if you know any other term and its position. For example, if you know the 3rd term and the common ratio, you can work backward to find the first term and then use the main nth term formula.
Can this calculator handle infinite series?
This calculator focuses on finite sequences (finding a specific nth term). The sum of an infinite series can only be calculated if the absolute value of the common ratio is less than 1.

© 2026 SEO Experts Inc. All Rights Reserved.


Leave a Reply

Your email address will not be published. Required fields are marked *