Makelist Primitive
Another way to construct a list programmatically is to use the makelist primitive.
See makelist.
This primitive has the format
The first four arguments are required; the last argument, step, is optional. Makelist creates a list by constructing a temporary variable using the name you specified in the argument x, and setting x equal to all numbers from x1 to x2 and repeatedly evaluating the expression f(x). The following definition creates a list of the integers from 1 to 6 (i.e., [1,2,3,4,5,6]):
Similarly, the following definition creates a list of the integers 1 to 6 squared (i.e., [1,4,9,16,25,36]):
Makelist normally increments the variable x by one after each iteration. You can specify a different step size by including a value for the step argument. The following expression creates a list of even numbers between 0 and 10 (i.e. [0,2,4,6,8,10]):
The expression you use for f(x) can be a complete equation or it can reference other functions you have defined.
See Create Lists.