62
\$\begingroup\$

Print integers 0 to 100 (inclusive) without using characters 123456789 in your code.

Separator of numbers can be comma or white space (by default <blank>, <horizontal tabulator>, <newline>, <carriage return>, <form feed> or <vertical tabulator>).

Shortest code wins.

\$\endgroup\$
7
  • 14
    \$\begingroup\$ Many tricks are made possible by allowing 0. Which is what makes this challenge interesting, IMO. \$\endgroup\$
    – Arnauld
    Feb 23, 2021 at 17:08
  • 3
    \$\begingroup\$ I thought "do X without Y" questions weren't allowed anymore. \$\endgroup\$
    – Purple P
    Feb 24, 2021 at 3:34
  • 3
    \$\begingroup\$ @PurpleP They're allowed, but discouraged. Interesting ones are fine. \$\endgroup\$ Feb 25, 2021 at 0:06
  • 14
    \$\begingroup\$ Is there a requirement to stop printing at 100? \$\endgroup\$
    – spuck
    Feb 25, 2021 at 16:44
  • 1
    \$\begingroup\$ Can I use non-ASCII encoding? \$\endgroup\$
    – user100411
    Oct 17, 2021 at 20:36

156 Answers 156

1 2 3 4 5
6
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, 2021 at 17:01
  • \$\begingroup\$ @Neil edited thanks \$\endgroup\$
    – Wasif
    Feb 23, 2021 at 17:53
  • \$\begingroup\$ Actually you don't need y at all, just use %x%00 in its place. \$\endgroup\$
    – Neil
    Feb 23, 2021 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, 2021 at 17:56
  • \$\begingroup\$ @Neil thanks! for that \$\endgroup\$
    – Wasif
    Feb 23, 2021 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, 2021 at 18:31
  • \$\begingroup\$ @att Nice one - thanks! :D \$\endgroup\$
    – Noodle9
    Feb 23, 2021 at 18:50
0
\$\begingroup\$

C++ gcc, 36 bytes

Try it online!

main(){for(;_<'e';)cout<<_++<<'\n';}

Explanation : I globally initialized varible _ so its initial value is 0, now ascii value of e is 101 so I ran the loop till my variable _ is less than 'e', instead of incrementing it inside the for loop I used post increment while printing to save 1 byte

edit: I misread the question and thought 0 is also not allowed :)

\$\endgroup\$
4
  • \$\begingroup\$ Could you explain the code please? \$\endgroup\$
    – user7467
    Oct 14, 2021 at 16:41
  • 1
    \$\begingroup\$ @Anush I have added explanation, hope it helps. \$\endgroup\$
    – cheems
    Oct 14, 2021 at 16:51
  • \$\begingroup\$ Do you know what this would be in C? \$\endgroup\$
    – user7467
    Oct 14, 2021 at 20:46
  • \$\begingroup\$ You'll have to include the _ declaration with the code I'm afraid, since it won't work without it. I'm not familiar with C++ golfing, but I believe you'd have to include the rest of the boilerplate, since this is a full program \$\endgroup\$
    – Jo King
    Oct 16, 2021 at 8:59
0
\$\begingroup\$

APOL, 11 bytes

f(ô p(∈));ô

I would've used instead of f, but the rules state that you have to include 0 so the fastest route was to just print 0-99 and slap 100 at the end.

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

APL, 13 bytes

0,⍳⍎'00',⍨⍕*0

*0 ⍝ Exponential of zero = 1
⍕ ⍝ Convert to symbol '1'
'00',⍨ ⍝ Append two zeros
⍎ ⍝ Convert to number 100
⍳ ⍝ Make sequence from 1 to 100
0, ⍝ Append zero to the left

\$\endgroup\$
1 2 3 4 5
6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.