The goal is to calculate all the squares up to x
with addition and subtraction.
Rules:
- The code must be a function which takes the total number of squares to generate, and returns an array containing all those squares.
- You can not use strings, structures, multiplication, division, or built-in functions for calculating squares.
- You can only use arrays, integers (whole numbers), addition, subtraction. No other operators allowed!
This is a code-golf question, so the shortest code in bytes wins!