Skip to main content
1 of 5
Ton Hospel
  • 14.9k
  • 1
  • 22
  • 45

Perl, 78 bytes

Includes +2 for lp

The input on STDIN is the sequence number, so 1 for 2 seats, 2 for 4 seats, 3 for 8 seats etc.

perl -lpe '$"=":";@F=($n=@F+1,map{;"{0,$n}+$_",$n}@F)for 1..$_}for(<@F>){s/[^:]+/$&/gee' <<< 3

This doesn't feel optimal at all...

Ton Hospel
  • 14.9k
  • 1
  • 22
  • 45