Satyam P.
asked 03/11/20Alogorithms basic fundamentals questions please help me?
The numbers in the table below are the result of executing an algorithm that has one parameter N, a non-negative integer, and produces sequences of integers as outputs. For values of N from 0 to 5, the algorithm produces the following sequences of numbers as outputs:
Determine the algorithm that was used to generate the numbers in this table, and
- Write it down.
- Execute it for N = 6, and write down your result.
What is the sequence of numbers for N = 6?
(Give your answer as integers separated by single spaces.)
1 Expert Answer

Patrick B. answered 03/11/20
Math and computer tutor/teacher
Here is the algorithm:
there are 3*N numbers in the row
* Squares the number N, then changes the sign... so -N^2
* adds 1 to previous
* adds 3 to previous
* adds 5 to previous
* adds 9 to previous
... continues to add the next consecutive odd # to previous
For N=6
-N^2 = -36 is the first number in the row sequence and there are 3*N = 18 numbers in the row
Then the following consecutive odds are added to each term
+1 +3 +5 +7 +9 +11+13+15+17+19+21+23 +25 +27+ 29 +31+33
so the 6th row is:
-36 -35 -32 -27 -20 -11 0 13 28 45 64 85 108 133 160 189 220 253
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Farjana A.
this algorithm answer is 18 20 22 24 26 28 30 32 34 36 38 40 42 4407/06/20