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