Hi PF!
When using Mathematica I input the code
f1[a_, n_] :=
f1[a, n] =
Join[Table[LegendreP[k, x], {k, 0, n, 1}],
Table[LegendreP[k, x], {k, 1, n, 1}]]
Then when I type ##f1[1, 3] ## I get an output. I then change the second table of ##f1## to start at 0 instead of 1, recompute...