## Perl 6, <s>52~72</s> 47~67 bytes This can properly be shorter: sub a($n,$x){EVAL("1,"x$n~"+*"x$n~"...*")[^$x]} Requires the module `MONKEY-SEE-NO-EVAL`, because of the following error: > ===SORRY!=== Error while compiling -e > EVAL is a very dangerous function!!! (use MONKEY-SEE-NO-EVAL to override, > but only if you're VERY sure your data contains no injection attacks) > at -e:1 $ perl6 -MMONKEY-SEE-NO-EVAL -e'a(3,8).say;sub a($n,$x){EVAL("1,"x$n~"+*"x$n~"...*")[^$x]}' (1 1 1 3 5 9 17 31)