Skip to main content
added 51 characters in body
Source Link
bb94
  • 3.7k
  • 14
  • 19

Perl 6, 11483 bytes

my &B={$^m??1-[+] (^$m).map: {combinations($m,$_)*B($_)/($m+1-$_)}!!1};say B slurp;

A faster, 114-byte solution:

my @b=1;for 1..+slurp() {@b.push: 1-[+] (^$^m).map: {([*] $m+1-$_..$m)*@b[$_]/($m+1-$_)/([*] 1..$_)}};say @b[*-1];

I could have made it shorter, but that would sacrifice lots of speed.

Perl 6, 114 bytes

my @b=1;for 1..+slurp() {@b.push: 1-[+] (^$^m).map: {([*] $m+1-$_..$m)*@b[$_]/($m+1-$_)/([*] 1..$_)}};say @b[*-1];

I could have made it shorter, but that would sacrifice lots of speed.

Perl 6, 83 bytes

my &B={$^m??1-[+] (^$m).map: {combinations($m,$_)*B($_)/($m+1-$_)}!!1};say B slurp;

A faster, 114-byte solution:

my @b=1;for 1..+slurp() {@b.push: 1-[+] (^$^m).map: {([*] $m+1-$_..$m)*@b[$_]/($m+1-$_)/([*] 1..$_)}};say @b[*-1];
Source Link
bb94
  • 3.7k
  • 14
  • 19

Perl 6, 114 bytes

my @b=1;for 1..+slurp() {@b.push: 1-[+] (^$^m).map: {([*] $m+1-$_..$m)*@b[$_]/($m+1-$_)/([*] 1..$_)}};say @b[*-1];

I could have made it shorter, but that would sacrifice lots of speed.