Question: Need the code for this in python (would appreciate code w/ detailed indent). Thank you. -- Consider the natural numbers laid out in a square
Need the code for this in python (would appreciate code w/ detailed indent). Thank you.
--


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 76 116 118 119 120 114 75 121 82 110 109 108 107 106 105 104 103 102 101 72 52 53 54 85 19 18 12 16 35 31 100 This spiral has several interesting features. The southeast diagonal has several prime numbers (3, 13,31,57, and 91) along it. The southwest diagonal has a weaker concentration of prime numbers (5, 17,37) along it. To construct the spiral we start with 1 at the center, with 2 to the right, and 3 below it, 4 to the left, and so on. A part of the problem for this assignment is to figure out the rule to fill the spiral for an arbirary size. Once you have that rule you can complete the rest of the assignment. You will prompt the user for the following information: Enter dimension: 57 Enter number in spiral: 42 The first line indicates the dimension of the square spiral. This number should be an odd number. If it is not then choose the dimension to be the next higher odd number. The second number must be in the rangc 1 and the square of the dimension. If the second number is not in that range, print an crror message Number not in Range and exit the program You will write the neigboring numbers of the second 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 71 42 21 70 41 20
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
