47
\$\begingroup\$

Print 0 to 100 without using characters 1,2,3,4,5,6,7,8,9 in your code.

Seperator of numbers can be comma, whitespace or newline.

Shortest code wins.

\$\endgroup\$
6
  • 12
    \$\begingroup\$ Many tricks are made possible by allowing 0. Which is what makes this challenge interesting, IMO. \$\endgroup\$
    – Arnauld
    Feb 23 at 17:08
  • 2
    \$\begingroup\$ I thought "do X without Y" questions weren't allowed anymore. \$\endgroup\$
    – Purple P
    Feb 24 at 3:34
  • 1
    \$\begingroup\$ @PurpleP They're allowed, but discouraged. Interesting ones are fine. \$\endgroup\$ Feb 25 at 0:06
  • 10
    \$\begingroup\$ Is there a requirement to stop printing at 100? \$\endgroup\$
    – spuck
    Feb 25 at 16:44
  • \$\begingroup\$ Can we do it in reverse order? \$\endgroup\$
    – Dion
    Oct 16 at 9:51

127 Answers 127

1 2 3 4
5
1
\$\begingroup\$

Ly, 9 5 bytes

'dR&u

Try it online!

Dropped 4 chars thanks for LyricLy(!)

Prints using LF as the delimiter by generating the list of 0-100 on the stack, then using a "print the whole stack" command.

 'd     - push 100 (codepoint for "d") on the stack
   R    - use "range" command to generate the list of numbers
    &u  - print the stack as integers
\$\endgroup\$
1
  • 1
    \$\begingroup\$ 'dR&u is 5 bytes using implicit 0 and the Range command. \$\endgroup\$
    – LyricLy
    Nov 8 at 7:49
0
\$\begingroup\$

Python 3, 33 bytes

for x in range(ord("e")):print(x)
\$\endgroup\$
0
\$\begingroup\$

Elixir, 26 bytes

for x<-0..?d,do: IO.puts x

Try it online!

\$\endgroup\$
0
\$\begingroup\$

Batch, 56 bytes

@set/ax=0xb-0xa
@for /l %%b in (0,%x%,%x%00)do @echo %%b

-61 bytes for @Neil

\$\endgroup\$
6
  • 1
    \$\begingroup\$ You can just use set/ax=0xb-0xa to set x etc. \$\endgroup\$
    – Neil
    Feb 23 at 17:01
  • \$\begingroup\$ @Neil edited thanks \$\endgroup\$
    – wasif
    Feb 23 at 17:53
  • \$\begingroup\$ Actually you don't need y at all, just use %x%00 in its place. \$\endgroup\$
    – Neil
    Feb 23 at 17:54
  • \$\begingroup\$ Also, some general Batch golfing tips: you don't need the space in set/a or )do, and you can remove the @echo off and use @set, @for and @echo instead. \$\endgroup\$
    – Neil
    Feb 23 at 17:56
  • \$\begingroup\$ @Neil thanks! for that \$\endgroup\$
    – wasif
    Feb 23 at 17:58
0
\$\begingroup\$

Red, 36 bytes

repeat n 0 +#"e"[print n +#"a"-#"b"]

Try it online!

\$\endgroup\$
0
\$\begingroup\$

C (gcc), 40 39 bytes

Saved a byte thanks to att!!!

f(i){for(i=0;i<'e';)printf("%d ",i++);}

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ 39 bytes \$\endgroup\$
    – att
    Feb 23 at 18:31
  • \$\begingroup\$ @att Nice one - thanks! :D \$\endgroup\$
    – Noodle9
    Feb 23 at 18:50
0
\$\begingroup\$

Pure Bash, 34 + 1 = 35 bytes

Filename must be x; this is for extra one byte.

echo $[x++]
a=x
((x>${#a}00))||. x

Try it online!

\$\endgroup\$
1 2 3 4
5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy