Question: Trusted Python 3 iew Insert Cell Kemel Widgets Help Question 3: Calculating sequences (3 points) You are given a numerical sequence that has the form
Trusted Python 3 iew Insert Cell Kemel Widgets Help Question 3: Calculating sequences (3 points) You are given a numerical sequence that has the form 1, 1,2.4,9.21,... Each successive number, after the first two, is found by adding twice the number before it and one less than the number before that. For example, the 7th number in the sequence is 2 21+(9-1) 50 A possibly useful hint: We might not have explicitly talked about it in class yet, but one really useful thing that Python allows you to do is index lists using negative numbers, which allows you to move backwards through the list as you increase the size of the negative number, starting with-1. That means that if I have the list stuff number, 4. If I want the second to last number, I would do stuff[-2] [1,2,3,4]. I can do stuffI-1] and I'll get the last Your goal is to write a loop that computes 50 terms in the sequence. Store this sequence as a list and then print the list. You should get the following output [1, 1, 2, 4, 9, 21, 50, 120, 289, 697, 1682, 486e, 9881, 23661, 57122, 1 37904, 332929, 883761, 1948450, 4684660, 11309769, 27304197, 65918162, 1 5914852e, 384199281, 927538921, 2239277842, 5406093004, 13051463049, 31509019161, 7606950125 e, 183648021600, 443365544449, 1070379110497, 2584123765442, 62386266413 80, 15861377848281, 36361388737781, 87784138523762, 211929657785384, 511643454094369, 123521 6565974841, 298207658604245e, 7199369738058940, 17380816662160329, 41961 001862379597 181302819786919522, 244566641436218640, 598436182659356801, 142543884675 4932241] 29]: #write your solution to question 3 in this cell #list- [1,1,2,4,9,21] #new-list-[] #for i in List: new number-(2 )+(t -1) terms-50 n2 1 count e new list [ while count
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
