How can I determine an algorithm from a table of numbers?
On input $n$, output
$$
0^2 - n^2, 1^2 - n^2, 2^2 - n^2, \ldots, (3n-1)^2 - n^2.
$$
In pseudocode:


  For integer $k$ from $0$ to $3n-1$, print $k^2-n^2$.