Question: Recall that an AP is specified by two terms a and d . The first term is a , and the d is how much

Recall that an AP is specified by two terms a and d. The first term is a, and the d is how much you add to each term to get the next term. So the first N terms of the above AP will be:
a,a+d,a+2d,***,a+(n-1)**d
Suppose, for example, that a=1,d=3, and n=5. Then this function should return the string 1,4,7,10,13
Page 4 of 8
Note some important things about the returned value: There are no newlines or spaces. Only commas separate the numbers. There is NO comma before the first number or after the last number. The format has to match exactly.
Your sixth miniquest - Terms of a GP
Copy and adapt the function in the previous mini-quest to turn it into a function that returns the terms of a geometric progression, rather than an arithmetic one. We're talking about changes to a couple of lines.
However, note that the parameter types are different. You should operate in double space to keep high precision (not in integer space).
Recall that a GP is specified by two terms a and r. The first term of the sequence is a, and the r is by how much multiply each term to get the next term. So the first N terms of the above AP will be:
 Recall that an AP is specified by two terms a and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!