Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions