zsh, 86 bytes
function { (for a in {1..$1};do for b in {1..$1};do echo $((a*b));done;done)|sort -nu}
Explanation / ungolfed:
function { # declare an anonymous function
( # begin subshell
for a in {1..$1} # loop through every pair of multiplicands
do
for b in {1..$1}
do
echo $((a*b)) # calculate a * b, output to stdout
done
done
) | sort -nu # pipe output of subshell to `sort -nu', sorting
# numerically (-n) and removing duplicates (-u for uniq)
}
This doesn't work in Bash because
Bash doesn't have anonymous functions.
Bash does not expand
{1..$1}
—it just interprets it literally (so,a=5; echo {1..$a}
outputs{1..5}
instead of1 2 3 4 5
).