DigitHelm

Number Sequence Calculator

Find the nth term of arithmetic, geometric, and other common sequences.

SEQUENCE TYPE

a, a+d, a+2d, …

What Is the Number Sequence Calculator?

This sequence calculator generates up to 100 terms for 7 classic number sequences: Arithmetic, Geometric, Fibonacci, Triangular, Square, Prime, and Lucas. It computes the nth term formula, the sum of n terms, and key statistics, all with one click.

  • 7 sequence types: arithmetic, geometric, Fibonacci, triangular, square numbers, prime numbers, and Lucas numbers.
  • Sum formula: every sequence shows both the closed-form sum formula and the computed sum for your n terms.
  • Prime sieve: the Sieve of Eratosthenes generates all primes up to the required count exactly.
  • Fibonacci golden ratio: shows the ratio F(n)/F(n−1) converging to φ ≈ 1.61803.
  • Geometric sum to infinity: for |r| < 1, shows the infinite series sum a₁/(1−r).
  • Copy list button: one click copies the full sequence as comma-separated values.

Formula

aₙ = a₁ + (n−1)d  |  aₙ = a₁·rⁿ⁻¹  |  F(n) = F(n−1) + F(n−2)
Arithmetic, Geometric, and Fibonacci nth-term formulas
Sequencenth TermSum of n TermsExample (first 5)
Arithmetica₁ + (n−1)dn/2 × (2a₁ + (n−1)d)1, 4, 7, 10, 13 (d=3)
Geometrica₁ × rⁿ⁻¹a₁(rⁿ−1)/(r−1)2, 6, 18, 54, 162 (r=3)
FibonacciF(n−1)+F(n−2)F(n+2)−11, 1, 2, 3, 5
Triangularn(n+1)/2n(n+1)(n+2)/61, 3, 6, 10, 15
Squaren(n+1)(2n+1)/61, 4, 9, 16, 25
LucasL(n−1)+L(n−2)L(n+2)−32, 1, 3, 4, 7
PrimeP(n) via sieveNo closed form2, 3, 5, 7, 11

How to Use

  1. 1Click the sequence type button: Arithmetic, Geometric, Fibonacci, Triangular, Square, Prime, or Lucas.
  2. 2For arithmetic sequences, enter the first term (a₁) and common difference (d).
  3. 3For geometric sequences, enter the first term (a₁) and common ratio (r).
  4. 4Enter the number of terms to generate (1–100).
  5. 5Click Generate or press Enter to display the terms, sum, and statistics.
  6. 6Click "Copy List" to copy the sequence to your clipboard.
  7. 7Click Clear to reset all inputs and start with a new sequence.

Example Calculation

Arithmetic sequence: a₁=5, d=3, n=8

Terms: 5, 8, 11, 14, 17, 20, 23, 26 nth term: aₙ = 5 + (n−1)×3 Sum (Sₙ): 8/2 × (2×5 + 7×3) = 4 × (10+21) = 4×31 = 124

Geometric sequence: a₁=2, r=3, n=6

Terms: 2, 6, 18, 54, 162, 486 nth term: aₙ = 2 × 3ⁿ⁻¹ Sum (Sₙ): 2×(3⁶−1)/(3−1) = 2×(729−1)/2 = 728

Fibonacci sequence, n=10

Terms: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 Sum: F(12)−1 = 144−1 = 143 F(10)/F(9) = 55/34 ≈ 1.61765 → converging to φ = 1.61803...

Geometric series sum to infinity

For |r| < 1, the geometric series converges: S∞ = a₁/(1−r). Example: a₁=1, r=0.5: S∞ = 1/(1−0.5) = 2. This is used in compound interest, signal decay, and infinite geometric problems in calculus.

Understanding Number Sequence

Arithmetic Sequences

An arithmetic sequence has a constant difference d between consecutive terms: a₁, a₁+d, a₁+2d, …. The nth term is aₙ = a₁ + (n−1)d. The sum of the first n terms is Sₙ = n(a₁+aₙ)/2, the average of the first and last term, multiplied by the count. This formula was famously derived by the young Gauss when tasked with summing 1 to 100: he noticed (1+100) + (2+99) + … = 50 pairs of 101, giving 5050.

  • d > 0: increasing sequence (e.g. counting by 5s: 0, 5, 10, 15, …)
  • d < 0: decreasing sequence (e.g. countdown)
  • d = 0: constant sequence (all terms equal a₁)
  • Applications: loan amortisation tables, calendar scheduling, staircase problems.

Geometric Sequences and Exponential Growth

A geometric sequence multiplies each term by a constant ratio r: a₁, a₁r, a₁r², …. The nth term is aₙ = a₁rⁿ⁻¹. The sum formula is Sₙ = a₁(rⁿ−1)/(r−1) for r ≠ 1. When |r| < 1, the series converges to S∞ = a₁/(1−r) as n→∞. Geometric sequences model exponential growth and decay, compound interest, bacterial doubling, radioactive decay, population growth.

  • r > 1: exponential growth (doubling: r=2; tripling: r=3)
  • 0 < r < 1: decay (converges; used in half-life problems)
  • r < 0: alternating series (terms switch sign each step)
  • Applications: compound interest, CPU clock multipliers, musical harmonics, population models.

Fibonacci Numbers and the Golden Ratio

The Fibonacci sequence is defined by F(n) = F(n−1) + F(n−2) with F(1) = F(2) = 1. The ratio of consecutive Fibonacci numbers converges to the golden ratio φ = (1+√5)/2 ≈ 1.61803. This appears throughout nature: spiral patterns in sunflowers, nautilus shells, and pinecone scales follow Fibonacci numbers. The sum of the first n Fibonacci numbers is F(n+2) − 1.

  • Binet's formula: F(n) = (φⁿ − ψⁿ) / √5, where ψ = (1−√5)/2 ≈ −0.618.
  • Every 3rd Fibonacci number is even; every 4th is divisible by 3; every 5th by 5.
  • GCD(F(m), F(n)) = F(GCD(m,n)), Fibonacci numbers have remarkable divisibility properties.
  • Used in algorithm complexity analysis, coin change problems, and dynamic programming.

Prime Numbers via the Sieve of Eratosthenes

Prime numbers are integers greater than 1 with no divisors other than 1 and themselves. This calculator uses the Sieve of Eratosthenes to generate any count of primes, one of the oldest known algorithms (c. 240 BC). Starting from 2, the sieve marks all multiples of each prime as composite, leaving only primes unmarked. The sieve runs in O(n log log n) time and is the most efficient algorithm for generating all primes up to a given bound.

  • There are infinitely many primes (Euclid's proof, c. 300 BC).
  • The 1000th prime is 7919; the millionth prime is 15,485,863.
  • Twin prime conjecture (unproven): infinitely many pairs of primes differing by 2.
  • Applications: RSA encryption, hash functions, modular arithmetic, random number generation.

Frequently Asked Questions

What is the difference between an arithmetic and a geometric sequence?

  • Arithmetic: adds a constant d each step. aₙ = a₁ + (n−1)d. Example: 2, 5, 8, 11, 14 (d=3).
  • Geometric: multiplies by a constant r each step. aₙ = a₁rⁿ⁻¹. Example: 3, 6, 12, 24, 48 (r=2).
  • Arithmetic growth is linear; geometric growth is exponential.
  • Arithmetic sum: average of first and last × count. Geometric sum: a₁(rⁿ−1)/(r−1).

To identify which type: check if differences are constant (arithmetic) or ratios are constant (geometric). If consecutive terms have a constant difference, it's arithmetic. If consecutive ratios are equal, it's geometric.

What is the Fibonacci sequence and why does it appear in nature?

The Fibonacci sequence is 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … where each term is the sum of the two preceding terms. It appears in nature because it describes optimal packing and growth patterns:

  • Sunflower seeds: 34 spirals one way, 55 the other (both Fibonacci)
  • Pineapple scales: typically 8 and 13 spirals
  • Leaf arrangement (phyllotaxis): consecutive leaves grow at 137.5° (the "golden angle")
  • The Fibonacci spiral approximates the golden spiral found in nautilus shells

The underlying reason is that Fibonacci growth minimises competition between leaves, seeds, or petals for space and light, an evolutionary optimum that nature discovered independently in many lineages.

How do I find the nth term of an arithmetic sequence?

The nth term formula for an arithmetic sequence is: aₙ = a₁ + (n−1) × d, where a₁ is the first term and d is the common difference.

Example: sequence 7, 10, 13, 16, 19, … a₁ = 7, d = 3 a₁₀₀ = 7 + (100−1) × 3 = 7 + 297 = 304

This formula lets you find any term without generating all preceding terms. To verify: check that the 100th term minus the 99th term equals d = 3.

What are triangular numbers and where are they used?

Triangular numbers count objects that can be arranged in equilateral triangles: 1, 3, 6, 10, 15, 21, 28, …. The nth triangular number is T(n) = n(n+1)/2.

  • Handshake problem: n people in a room → T(n−1) = n(n−1)/2 handshakes.
  • Staircase problem: stairs with 1, 2, 3, … steps → total steps up to the nth stair = T(n).
  • Every integer is the sum of at most 3 triangular numbers (Gauss, 1796).
  • Bowling: 10 pins = T(4); snooker: 15 reds = T(5).

What is the sum formula for a geometric series?

The sum of the first n terms of a geometric series is: Sₙ = a₁(rⁿ − 1) / (r − 1) for r ≠ 1. For r = 1, all terms equal a₁ so Sₙ = n × a₁.

a₁ = 5, r = 2, n = 6 S₆ = 5 × (2⁶ − 1) / (2 − 1) = 5 × 63 / 1 = 315 Terms: 5, 10, 20, 40, 80, 160 → sum = 315 ✓ For |r| < 1: infinite sum S∞ = a₁ / (1 − r) Example: a₁=1, r=0.5: S∞ = 1 / 0.5 = 2

What are Lucas numbers and how do they differ from Fibonacci?

Lucas numbers follow the same recurrence as Fibonacci (L(n) = L(n−1) + L(n−2)) but start with L(1) = 2, L(2) = 1, giving: 2, 1, 3, 4, 7, 11, 18, 29, 47, 76, …

  • Like Fibonacci, the ratio L(n)/L(n−1) converges to φ ≈ 1.61803.
  • L(n) = F(n−1) + F(n+1), Lucas and Fibonacci numbers are intimately related.
  • Lucas numbers appear in primality testing (Lucas primality tests).
  • Used in cryptography and the analysis of the Euclidean algorithm.

The Fibonacci and Lucas sequences are the two canonical sequences satisfying the golden ratio recurrence, differing only in initial conditions.

How does the Sieve of Eratosthenes work for generating primes?

The Sieve of Eratosthenes is an ancient algorithm for finding all primes up to a given limit:

  • 1. Write all integers from 2 to N.
  • 2. Starting with p = 2 (first prime), mark all multiples 4, 6, 8, … as composite.
  • 3. Find the next unmarked number (3), it is prime. Mark its multiples 9, 12, 15, …
  • 4. Repeat for the next unmarked number until p² > N.
  • 5. All remaining unmarked numbers are prime.

The algorithm runs in O(N log log N) time and O(N) space. It is the most efficient way to generate all primes below a given bound and has been in continuous use for 2,200 years.

Related Calculators