Question

Write the code for an iterative algorithm to produce the series 0, 1, 3, 7, 15,...

Write the code for an iterative algorithm to produce the series 0, 1, 3, 7, 15, 31
0 0
Add a comment Improve this question Transcribed image text
Answer #1

We can see that the general formula for the series is for the ith term.

Code in Python to produce the same list:

    def series(n): #Produces list of first n numbers in series
        for x in range(0,n):
            print((2**x)-1,end=" ")
   
    series(6)       

Screenshot of output:

Please upvote if you find the answer useful.

Add a comment
Know the answer?
Add Answer to:
Write the code for an iterative algorithm to produce the series 0, 1, 3, 7, 15,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT