Skip to main content
-48 bytes
Source Link

Bash, 14395 bytes

${c=echo
$c }case \$1 in
pastefor <($c "`$c {1..4294967295..2}"(i=0;i<2**32;i++)$c odd;;);{
"`"$c"$i) <$c`($c "`$c {2..4294967294..2}"(i%2)$c even;;
"`")|sed 's/\t\t*/\n/g'&&$c\odd||$c\even`;;"
$c esac}
$c\esac

Attempt This Online! Attempt This Online!

-20 bytes by DigitalTrauma

i think brace expansion is limited to lower numbers than 4 billion
-48 bytes by myself, but in concept it works (tested with 13 and 12 as limits).a simple for loop

header:

case $1 in

segments:

i)echo even/odd;;

footer:

esac

Bash brace expansions (which is what {x..y..step} is) are applied to their surrounding string, so Explanation:

a${b,cc=echo } returnsboth assigns the variable ab$c to echo ac. we build an array of all odds (note the trailing space), and another of all evensexpands said variable. after expansion, then we zip them by pasting onethe whole script becomes

echo 'case $1 in'
for ((i=0;i<2**32;i++));{
echo "$i)echo `((i%2 == 1))&&echo odd||echo even`;;"
}
echo 'esac'

from each arrayhere, converting tabsthe rest should be easy enough to newlinesfollow, once you know that in bash, code in backticks is executed, then the backticks and repeating until both arraystheir contained code are exhausted.replaced by the standard output of that execution

Bash, 143 bytes

c=echo
$c case \$1 in
paste <($c "`$c {1..4294967295..2}")$c odd;;
"`") <($c "`$c {2..4294967294..2}")$c even;;
"`")|sed 's/\t\t*/\n/g'
$c esac

Attempt This Online! -20 bytes by DigitalTrauma

i think brace expansion is limited to lower numbers than 4 billion, but in concept it works (tested with 13 and 12 as limits).

header:

case $1 in

segments:

i)echo even/odd;;

footer:

esac

Bash brace expansions (which is what {x..y..step} is) are applied to their surrounding string, so a{b,c} returns ab ac. we build an array of all odds and another of all evens, then we zip them by pasting one from each array, converting tabs to newlines, and repeating until both arrays are exhausted.

Bash, 95 bytes

${c=echo }case \$1 in
for ((i=0;i<2**32;i++));{
$c"$i)$c`((i%2))&&$c\odd||$c\even`;;"
}
$c\esac

Attempt This Online!

-20 bytes by DigitalTrauma
-48 bytes by myself, with a simple for loop

header:

case $1 in

segments:

i)echo even/odd;;

footer:

esac

Explanation:

${c=echo } both assigns the variable $c to echo (note the trailing space), and expands said variable. after expansion, the whole script becomes

echo 'case $1 in'
for ((i=0;i<2**32;i++));{
echo "$i)echo `((i%2 == 1))&&echo odd||echo even`;;"
}
echo 'esac'

from here, the rest should be easy enough to follow, once you know that in bash, code in backticks is executed, then the backticks and their contained code are replaced by the standard output of that execution

-36 bytes
Source Link

Bash, 163143 bytes

c=echo
$c case \$1 in
o=`$cpaste <($c "`$c {1..4294967295..2}")$c odd;;
"`
e=`$c"`") <($c "`$c {2..4294967294..2}")$c even;;
"`
paste <($c "${o[*]}") <($c "${e[*]}""`")|sed 's/\t\t*/\n/g'
$c esac

Attempt This Online! -20 bytes by DigitalTrauma

i think brace expansion is limited to lower numbers than 4 billion, but in concept it works (tested with 13 and 12 as limits).

header:

case $1 in

segments:

i)echo even/odd;;

footer:

esac

Bash brace expansions (which is what {x..y..step} is) are applied to their surrounding string, so a{b,c} returns ab ac. we build an array of all odds and another of all evens, then we zip them by pasting one from each array, converting tabs to newlines, and repeating until both arrays are exhausted.

Attempt This Online!

Bash, 163 bytes

c=echo
$c case \$1 in
o=`$c {1..4294967295..2}")$c odd;;
"`
e=`$c {2..4294967294..2}")$c even;;
"`
paste <($c "${o[*]}") <($c "${e[*]}")|sed 's/\t\t*/\n/g'
$c esac

i think brace expansion is limited to lower numbers than 4 billion, but in concept it works (tested with 13 and 12 as limits).

header:

case $1 in

segments:

i)echo even/odd;;

footer:

esac

Bash brace expansions (which is what {x..y..step} is) are applied to their surrounding string, so a{b,c} returns ab ac. we build an array of all odds and another of all evens, then we zip them by pasting one from each array, converting tabs to newlines, and repeating until both arrays are exhausted.

Attempt This Online!

Bash, 143 bytes

c=echo
$c case \$1 in
paste <($c "`$c {1..4294967295..2}")$c odd;;
"`") <($c "`$c {2..4294967294..2}")$c even;;
"`")|sed 's/\t\t*/\n/g'
$c esac

Attempt This Online! -20 bytes by DigitalTrauma

i think brace expansion is limited to lower numbers than 4 billion, but in concept it works (tested with 13 and 12 as limits).

header:

case $1 in

segments:

i)echo even/odd;;

footer:

esac

Bash brace expansions (which is what {x..y..step} is) are applied to their surrounding string, so a{b,c} returns ab ac. we build an array of all odds and another of all evens, then we zip them by pasting one from each array, converting tabs to newlines, and repeating until both arrays are exhausted.

Source Link

Bash, 163 bytes

c=echo
$c case \$1 in
o=`$c {1..4294967295..2}")$c odd;;
"`
e=`$c {2..4294967294..2}")$c even;;
"`
paste <($c "${o[*]}") <($c "${e[*]}")|sed 's/\t\t*/\n/g'
$c esac

i think brace expansion is limited to lower numbers than 4 billion, but in concept it works (tested with 13 and 12 as limits).

header:

case $1 in

segments:

i)echo even/odd;;

footer:

esac

Bash brace expansions (which is what {x..y..step} is) are applied to their surrounding string, so a{b,c} returns ab ac. we build an array of all odds and another of all evens, then we zip them by pasting one from each array, converting tabs to newlines, and repeating until both arrays are exhausted.

Attempt This Online!