Question: I need help populating an array in python. Everything else seems like it will be pretty simple once I get it populated. Consider the natural

I need help populating an array in python. Everything else seems like it will be pretty simple once I get it populated.

I need help populating an array in python. Everything else seems like

Consider the natural numbers laid out in a square spiral, with 1 occupying the center of the spiral. The central 11 x 11 subset of that spiral is shown in the table below 112 113 115 119 10 109 108 107 106 105 81 82 15 17 19 83 42 51 41 10 27 28 53 87 16 103 102 l01 37 36 31 58 93 35 57 92 64 90 100 97 95 91 This spiral has several interesting features. The southeast diagonal has several prime numbers (3, 13, 31. 57, and91) along it. The southwest diagonal has a weaker conceutration of prime numbers (5, 17, 37) alongit lo coastruct the spiral we start with 1 at the center. with 2 to the right, aud 3 below it, 4 to the left, and so ou. A part of the problem for this assignmeut is to figure out the rule to fill the spiral for an arbirary size. Once you have that mle you can complete the rest of the assignment. You will prompt the user for the following information: Entar diman:ion: S7 Fnter numer in spiral: 42 The first line indicates the dimension of the square spiral. This mmber should be an odd number. fi is not then choose the dimension to be the next higher odd numher. The second number must be in the range 1 and the square of the dimension. If the second uumber is not in that range, print a error message Nimber not in Range aud exit the progra You will write the neigboring numbers of the socond number in three lines. Each line will have three integers separated by a single white space. If the second number was 42, then this should be your output 72 43 44 70 41 20 Consider the natural numbers laid out in a square spiral, with 1 occupying the center of the spiral. The central 11 x 11 subset of that spiral is shown in the table below 112 113 115 119 10 109 108 107 106 105 81 82 15 17 19 83 42 51 41 10 27 28 53 87 16 103 102 l01 37 36 31 58 93 35 57 92 64 90 100 97 95 91 This spiral has several interesting features. The southeast diagonal has several prime numbers (3, 13, 31. 57, and91) along it. The southwest diagonal has a weaker conceutration of prime numbers (5, 17, 37) alongit lo coastruct the spiral we start with 1 at the center. with 2 to the right, aud 3 below it, 4 to the left, and so ou. A part of the problem for this assignmeut is to figure out the rule to fill the spiral for an arbirary size. Once you have that mle you can complete the rest of the assignment. You will prompt the user for the following information: Entar diman:ion: S7 Fnter numer in spiral: 42 The first line indicates the dimension of the square spiral. This mmber should be an odd number. fi is not then choose the dimension to be the next higher odd numher. The second number must be in the range 1 and the square of the dimension. If the second uumber is not in that range, print a error message Nimber not in Range aud exit the progra You will write the neigboring numbers of the socond number in three lines. Each line will have three integers separated by a single white space. If the second number was 42, then this should be your output 72 43 44 70 41 20

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!