f
that takes an integer n
and returns a beautiful array of length n
.n
is 1, return the array [1]
as the base case.f
to get a beautiful array for the first (n+1)/2
numbers (which will contain all the odd numbers up to n
).f
to get a beautiful array for the first n/2
numbers (which will contain all the even numbers up to n
).1, 3, 5, ...
by multiplying each number by 2 and subtracting 1.2, 4, 6, ...
by multiplying each number by 2.