Skip to main content
edited body
Source Link
Ton Hospel
  • 14.9k
  • 1
  • 22
  • 45

Perl, 78 75 72 bytes

Includes +1 for n

perl -nE '$"=",";say<@{[map"{@{[map$`*($_-.5)/@z,@z=1..$_&-$_]}}",/$/..~$_-$_]1]}\\ >' <<< 8

Prints a space separated sequence of comma separated numbers (replace the final space by \n for a more readable output)

Uses a string substitution inside a string substitution.

Perl, 78 75 72 bytes

Includes +1 for n

perl -nE '$"=",";say<@{[map"{@{[map$`*($_-.5)/@z,@z=1..$_&-$_]}}",/$/..~-$_]}\\ >' <<< 8

Prints a space separated sequence of comma separated numbers (replace the final space by \n for a more readable output)

Uses a string substitution inside a string substitution.

Perl, 78 75 72 bytes

Includes +1 for n

perl -nE '$"=",";say<@{[map"{@{[map$`*($_-.5)/@z,@z=1..$_&-$_]}}",/$/..$_-1]}\\ >' <<< 8

Prints a space separated sequence of comma separated numbers (replace the final space by \n for a more readable output)

Uses a string substitution inside a string substitution.

edited body
Source Link
Ton Hospel
  • 14.9k
  • 1
  • 22
  • 45

Perl, 78 7575 72 bytes

Includes +1 for n

perl -nE '$"=",";print<@";say<@{[map"{@{[map$`*($_-.5)/@z,@z=1..$_&-$_]}}",/$/..$_~-1]$_]}\\\n>'\\ >' <<< 8

(use say instead Prints a space separated sequence of comma separated numbers (replace the final space by print\n if you don't mind the extra newlinefor a more readable output).

Uses a string substitution inside a string substitution.

This doesn't feel optimal at all... (assuming it is even correct)

Perl, 78 75 bytes

Includes +1 for n

perl -nE '$"=",";print<@{[map"{@{[map$`*($_-.5)/@z,@z=1..$_&-$_]}}",/$/..$_-1]}\\\n>' <<< 8

(use say instead of print if you don't mind the extra newline).

Uses a string substitution inside a string substitution.

This doesn't feel optimal at all... (assuming it is even correct)

Perl, 78 75 72 bytes

Includes +1 for n

perl -nE '$"=",";say<@{[map"{@{[map$`*($_-.5)/@z,@z=1..$_&-$_]}}",/$/..~-$_]}\\ >' <<< 8

Prints a space separated sequence of comma separated numbers (replace the final space by \n for a more readable output)

Uses a string substitution inside a string substitution.

deleted 32 characters in body
Source Link
Ton Hospel
  • 14.9k
  • 1
  • 22
  • 45

Perl, 7878 75 bytes

Includes +2 for lp

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

perl -lpe '$"="\\nE ";@F=($n=@F+1'$"=",map";print<@{;"[map"{0@{[map$`*($_-.5)/@z,$n@z=1..$_&-$_]}+$_",$n}@F)for 1",/$/..$_-1]}for(<@F>){s/\S+/$&/gee'\\\n>' <<< 38

(use say instead of print if you don't mind the extra newline).

Uses a string substitution inside a string substitution.

This doesn't feel optimal at all... (assuming it is even correct)

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/\S+/$&/gee' <<< 3

This doesn't feel optimal at all... (assuming it is even correct)

Perl, 78 75 bytes

Includes +1 for n

perl -nE '$"=",";print<@{[map"{@{[map$`*($_-.5)/@z,@z=1..$_&-$_]}}",/$/..$_-1]}\\\n>' <<< 8

(use say instead of print if you don't mind the extra newline).

Uses a string substitution inside a string substitution.

This doesn't feel optimal at all... (assuming it is even correct)

added 2 characters in body
Source Link
Ton Hospel
  • 14.9k
  • 1
  • 22
  • 45
Loading
Source Link
Ton Hospel
  • 14.9k
  • 1
  • 22
  • 45
Loading