{"id":16125,"date":"2021-08-12T09:36:58","date_gmt":"2021-08-12T04:06:58","guid":{"rendered":"https:\/\/python-programs.com\/?p=16125"},"modified":"2021-11-22T18:38:26","modified_gmt":"2021-11-22T13:08:26","slug":"python-program-to-find-sum-of-geometric-progression-series","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-sum-of-geometric-progression-series\/","title":{"rendered":"Python Program to Find Sum of Geometric Progression Series"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Repeat String N times with Separator<\/a>
\nGeometric progression series<\/strong><\/p>\n

A geometric progression series is one in which any two consecutive terms have the same ratio. As a result, we can find the subsequent term by multiplying the common ratio by the previous term.<\/p>\n

This is how the series looks:\u00a0 \u00a0a, ar, ar2<\/sup>, ar3<\/sup>, ar4<\/sup>, . . . . .<\/b><\/p>\n

where common ratio(r)=2nd term\/1st term (T2\/T1) or (T3\/T2)<\/p>\n

Standard Formula to find the sum of series in G.P = \u00a0a(1 \u2013 rn<\/sup>)\/(1 \u2013 r)<\/strong><\/p>\n

Given First term(a), common ratio(r), Nth term(total number of terms ) in Series, The task is to find Sum of the Geometric Progression Series.<\/p>\n

Example: 2,6,18,54,162,486,1458,. . . . . . . .<\/p>\n

Here a=2 , r=6\/2 =3 , let n=10<\/p>\n

Formula to find Nth term =\u00a0arn<\/sup>–<\/sup>1\u00a0\u00a0<\/sup><\/b><\/p>\n

= 39366<\/p>\n

sum of series = a(1 \u2013 rn<\/sup>)\/(1 \u2013 r) <\/strong>=59048<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Total number of terms=4\r\nGiven First Term = 3\r\nGiven common ratio = 3<\/pre>\n

Output:<\/strong><\/p>\n

The sum of the given geometric progression series = 120<\/pre>\n

Example 2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Total number of terms=6\r\nGiven First Term = 4 \r\nGiven common ratio = 5<\/pre>\n

Output:<\/strong><\/p>\n

The sum of the given geometric progression series = 15624<\/pre>\n

Program to Find Sum of Geometric Progression Series<\/h2>\n

Below are the ways to find the Sum of the Geometric Progression Series.<\/p>\n