A sequence of numbers is called an Arithmetic progression if the difference between any two consecutive terms is always the same.
In simple terms, it means that the next number in the series is calculated by adding a fixed number to the previous number in the series.
Sequence 1, 4, 7,10 is an AP because the difference between any two consecutive terms in the series (common difference) is the same.
The difference between 2nd and 1st term 4 – 1 = 3
The difference between 3rd and 2nd term 7 – 4 = 3
The difference between 4th and 3rd term10 – 7 = 3
From the above example, we can conclude that there is some common difference between any two consecutive elements.
Notation in Arithmetic Progression
In AP, there are some main terms that are generally used, which are denoted as:
- Initial term (a): In an arithmetic progression, the first number in the series is called the initial term.
- Common difference (d): The value by which consecutive terms increase or decrease is called the common difference. The behavior of the arithmetic progression depends on the common difference d. If the common difference is: positive, then the members (terms) will grow towards positive infinity or negative, then the members (terms) will grow towards negative infinity.
- nth Term (an): The nth term of the AP series
- Sum of the first n terms (Sn): The sum of the first n terms of the AP series.
The formula for the nth term of an A.P:
If ‘a’ is the initial term and ‘d’ is a common difference. Thus, the explicit formula is
The formula for the sum of n terms of AP:
How do we check whether a series is an arithmetic progression or not?
1. Brute approach.
The idea is to sort the given array or series. After sorting, check if the differences between consecutive elements are the same or not. If all differences are the same, Arithmetic Progression is possible.
Below is the implementation of this approach:
Time Complexity: O(n Log n).
Auxiliary Space: O(1)
2. Efficient solutions
Basic Program related to Arithmetic Progression
- Program for sum of arithmetic series
- Program to print Arithmetic Progression series
- Longest arithmetic progression with the given common difference
- Check whether Arithmetic Progression can be formed from the given array
- Find the missing number in Arithmetic Progression
- Find N Arithmetic Means between A and B
- Sum of the numbers upto N that are divisible by 2 or 5
- Find First element in AP which is multiple of given prime
More problems related to Arithmetic Progression
- Sum of first n terms of a given series 3, 6, 11, …..
- Ratio of mth and nth terms of an A. P. with given ratio of sums
- Probability for three randomly chosen numbers to be in AP
- Print all triplets in sorted array that form AP
- Program for N-th term of Arithmetic Progression series
- Sum of Arithmetic Geometric Sequence
- Count of AP (Arithmetic Progression) Subsequences in an array