Q:

A geometric progression is a sequence of numbers in which each value (after the first) is obtained by multiplying the previous value in the sequence by a fixed value called the common ratio. for example the sequence 3, 12, 48, 192, ... is a geometric progression in which the common ratio is 4. given the positive integer ratio greater than 1, and the non-negative integer n, create a list consisting of the geometric progression of numbers between (and including) 1 and n with a common ratio of ratio. for example, if ratio is 2 and n is 8, the list would be [1, 2, 4, 8]. associate the list with the variable geom_prog.

Accepted Solution

A:
The geometric progression with common ratio as 'r', first term as 'a' and nth term as 'n' is a,ar,ar^{2}, ar^{3},.....ar^{n-1}.Let the common ratio(r) be 3 and n be 27.Let the first term(a) of the sequence = 1Second term of the sequence= ar= 1 x 3= 3Third term of the sequence= ar^{2}= 1 x 3^{2}= 9Fourth term of the sequence= ar^{3}= 1 x 3^{3}= 27So, the list of numbers with r=3 and n=27 is [1,3,9,27].