# Print 0 to 100 without 1-9 characters

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.

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

# Vim, 20 bytes

i0<esc><C-A>s<C-R>=range(<C-R>"0<C-R>")



Try it online!

Trying to improve on Razetime's answer, I stumbled upon the range function, which works wonders for this task. i<C-R>=range(101)\n would print the numbers we want, we just need to be a little creative to do it without 1.

### Explanation

i0<esc><C-A>s<C-R>=range(<C-R>"0<C-R>")
i0<esc>                                    Insert a single 0
<C-A>                               Increase it to a 1
s                              Cut the 1 and go back to insert mode
<C-R>=                        Write the result of the following function
range(             )    A range of numbers from 0 to N-1
<C-R>"            The last text that was deleted (1)
0           0
<C-R>"     1 again

• -4 bytes by using tab autocomplete on the range() function. Also, it doesn't work on TIO, but if you start Vim with the +startinsert flag, you don't need the i at the beginning and save another -1 bytes: vim +startinsert testfile Apr 26, 2021 at 14:03

# v³, 96 93 bytes

^+++(###....+###....+++<..#+...-....###+.@#+...$)+).>+++.$#+...^##=.+###.-#+....+)<++(-+##++>


Unwrapped:

        ^ + + +
( # # #
. . . .
+ # # #
. . . . + + + < . . # + . . . -
. . . . # # # + . @ # + . . . $) + ) . > + + + .$ # + . . . ^
# # = . + # # # . - # + . . . .
+ ) < +
+ ( - +
# # + +
> . . .


I'm not able to provide a direct link, but here you should be able to fork the project and replace the script.txt with either of the above scripts.

• NO idea what this is doing but it looks so pretty 😍 +1 Mar 6, 2021 at 4:14

# Bash, 15

seq dc<<<A0Kf


Try it online!

• 1 byte saved, thanks to @manatwork.

# Pure Bash (no external utilities), 23

• 9 bytes saved thanks to @ArcticKona.
eval echo {0..$[++x]00}  Try it online! • Your newest solution skips “0” because you missed a space between seq's parameters. Sorry, that looks like +1 character. ☹ Feb 23, 2021 at 20:28 • @manatwork oops - yes, thanks - fixed. Feb 23, 2021 at 20:30 • As apology, here is a 15 character one, still based on your idea: seq dc<<<A0Kf. Feb 23, 2021 at 20:31 • @Downvoter - please explain how I may improve this answer. Feb 23, 2021 at 20:56 • for pure bash try eval echo {0..$[++x]00} Oct 29, 2021 at 7:40

# Rust, 414039 35 bytes

Thanks to Redwolf for -1 byte, Unrelated String for -4

||for i in 0..b'e'{print!("{} ",i)}


Try it online!

### 39 bytes

||(0..b'e').all(|i|print!("{} ",i)==())


Try it online!

### 40 bytes

||(0..b'e').for_each(|i|print!("{} ",i))


Try it online!

• Welcome to Code Golf, and nice first answer! Can you save a byte by getting rid of that space before i in the print!? Oct 30, 2021 at 22:12
• Would this work for 35? Oct 30, 2021 at 23:58

# PICO-8, 50 45 bytes

i=0-#"0"repeat i+=#"0"?i
until#tostr(i)>#"00"


-5 bytes by replacing print with its shorthand, ?.

Demo (50 byte version; 45 byte version has same output):

• Glad to see some PICO-8 on CGCC! It's such a fun little engine to tinker around with. Nov 3, 2021 at 8:50

# APL (Dyalog), 19 bytes

⎕←0,⍳(+/⍳≢⍬⍬⍬⍬)*≢⍬⍬


Try it here!

≢⍬⍬⍬⍬ ⍝ This evaluates to 4
≢⍬⍬ ⍝ This evaluates to 2

⍳≢⍬⍬⍬⍬ ⍝ Evaluates to 1 2 3 4
(+/⍳≢⍬⍬⍬⍬) ⍝ Sums up previous list, 1+2+3+4 = 10
(+/⍳≢⍬⍬⍬⍬)*≢⍬⍬ ⍝ Exponentiates previous result by 2
⍳(+/⍳≢⍬⍬⍬⍬)*≢⍬⍬ ⍝ Generates 1 2 ... 100
0,⍳(+/⍳≢⍬⍬⍬⍬)*≢⍬⍬ ⍝ Appends to 0 to front

• Welcome to Code Golf, and nice answer! Nov 9, 2021 at 20:23

# Javascript, 48 bytes

for(a of Array("e".charCodeAt()).keys())alert(a)


Can be shorter, if you allow in reverse (36 chars)

for(i="e".charCodeAt();--i;)alert(i)

• Your 50 bytes solution doesn't output 0. To fix it just remove that unnecessary pre-incrementation and change the "d" to "e". Feb 27, 2021 at 22:22
• @manatwork i thought we didnt have to print 0, at the time i wrote the solution. I'll fix it :) thanks
– user100752
Feb 28, 2021 at 16:52
• 40 forward
– l4m2
Mar 28 at 19:20

# jq, 20 characters

range("e"|explode[])


Sample run:

bash-5.0$jq -n 'range("e"|explode[])' | head 0 1 2 3 4 5 6 7 8 9  Try it online! # APL(Dyalog Unicode), 8 bytes SBCS ⍳⎕UCS'e'  Try it on APLgolf! A tradfn submission which prints with space separator. # Julia 1.0, 19 bytes println.(0:0xA*0xA)  Try it online! # bc, 17 bytes for(;i<=A*A;i++)i  Try it online! # K (ngn/k), 6 bytes !0+"e"  Try it online! Uses 0+ to convert "e" to an integer, then takes the range from 0 up to, but not including, that value (101). # Rattle, 14 bytes i+Rc0c0$[+i]~


Try it online!

# Explanation

i                    prints the value at the top of the stack (0)
+                   adds 1 to the value on top of the stack (which was 0, is now 1.0)
R                 reformats the top of the stack with the arg  (the value at the top of the stack).
since  = 1, it reformats the top of the stack as the integer 1
c0c0             concatenates the value in storage at the current pointer (=0) to the top of the
stack twice, resulting in "100"
$swaps the value on top of the stack (100) with the value in storage at the current pointer (0) [ .... ]~ loop structure: loops ~ times, where ~ = value_in_storage_at_pointer = 100 + adds one to the value on top of the stack i prints the top of the stack as an integer  Note: the above code is based on version 1.0.* of Rattle. With the newest update (1.1.0), the code could be shortened to the following snippet (12 bytes) because the addition operator will now keep the top of the stack the same type (in this case, an integer) if possible. i+c0c0$[+i]~


# Whitespace, 58 bytes

Another in the theme of "this language doesn't even care about digit characters".





Try it online!

[Push  0
][Label

][Dup
][PrintNum
][Push  10
][PrintChar
][Push  1
][Push  101
][Subtract	  	][JmpNeg

]


Try it online!

# MY BASIC, 29 bytes; BBC BASIC 27 bytes

for i=0 to 0xa*0xa
print i
next


Try it online!

Edit: Thanks for upvoting! I have found there is a BASIC dialect with even shorter syntax for hexadecimals (it's in BBC BASIC):

for i=0 to &a*&a
print i
next


that's minus 2 bytes :)

• Welcome to the site, and nice first answer! Feb 26, 2021 at 15:48
• Doesn't BBC BASIC also have keyword abbreviations e.g. p.i for print i?
– Neil
Mar 8, 2021 at 0:36
• that would normally be done with a question mark: ? i - but not in BBC BASIC Mar 8, 2021 at 19:58

# Bash, 26 bytes

eval echo {$[x++]..${x}00}


Try it online!

# Bash, 28 bytes

eval echo {$((++x))..${x}00}


Try it online!

• Welcome to Code Golf! Nice first answer. Feb 27, 2021 at 0:05
• Your solution doesn't output 0, but fortunately the fix will cost you no extra character: just change the pre-increment to post-increment. While fixing it, you could change the $((..)) arithmetic evaluation to the deprecated but still functional old $[..] syntax to save 2 characters. (We have Tips for golfing in Bash in case you are looking for more tips.) Feb 27, 2021 at 0:12
• Thx for the tips @manatwork. Updated Mar 2, 2021 at 3:05

# Vim, 21 bytes

qqYP<C-x>qi0<esc><C-a>a00@q<esc>Yxx@0


Try it online!

### Explanation

qq       q                             Record macro q:
Y                                     Yank the current line
P                                    Paste a copy of it on the line above
<C-x>                               Decrement the number under the cursor
i0<esc>                      Insert a 0
<C-a>                 Increment it to 1
a00@q<esc>       Append 00@q
Y      Yank this line (100@q)
xx    Delete the @q part
@0  Execute the yanked text as commands
(100@q executes the q macro 100 times)


# Perl 5 (ppencode-compatible), 64 bytes

You didn't clarify that I must separate each with exactly one character, so here it is mine.

print length uc xor s qq q xor print while length ne ord qw q eq


Try it online!

   # print(length) did not work for zero as $_ is not defined at then print length uc xor s qq q xor # delimiter print while # equals to: length ne 101 length ne ord qw q eq  # Befunge-93, 16 13 bytes Thanks to @Cinaski for saving 3 bytes with \! instead of "ba"-. :.\!+:"d"#@_  Try it online! Uses \! to NOT the 0 at the bottom of the stack and uses that to increment the loop, then tests if the counter is greater than d to end. Certainly not the shortest answer, but this is my first golf challenge, and I wanted to practice Befunge, which I decided to pick up yesterday. This is also my first time trying a stack-based language, and I'm having a lot of fun with it. • Welcome to Code Golf. Nice first answer! Mar 11, 2021 at 15:04 • Welcome to the site! You can save 3 bytes by replacing "ba"- with \! 13 bytes Mar 11, 2021 at 15:25 # Zig, 636647 72 bytes fn a()void{for(" "**'e')|_,i|{@import("std").debug.print("{d} ",.{i});}}  Try it online! I've excluded the @import() boilerplate as it seems analogous to C's #include, which is excluded from other answers. If deemed necessary, I will add it back in. ## Explanation fn a() void { for (" " ** 'e') |_, i| { @import("std").debug.print("{d} ",.{i}); } }  • fn a() void Declare a function which takes no parameters and returns nothing • for () |_, i| For every item in the array inside of (), iterate and capture the entree as _ (a throwaway variable) and the index as i • " " ** 'e' Take the string (strings are slices, or pointer-arrays which know their length) and repeat it 'e' (101) times • ** Requires a little bit more more explanation I think: In Zig, there is the concept of "comptime" (compile time) and runtime. ** is an operator which repeats any array literal or slice literal at comptime, because the resulting length is still known to the compiler. • @import("std").debug.print("",.{}); Print to STDERR (I believe that's valid for this question, right?), the first argument is the formatting string, and the second is an "anonymous sctruct"/tuple with a variable number of arguments in it (Zig doesn't have var-args). • "{d} " The format string. Zig denotes {} as the formatting characters, with d meaning a digit in this case. # Rust, 46 bytes I did not see a rust solution, so here's my attempt: ||print!("{:?}",(0..b'e').collect::<Vec<_>>())  Try it online! Thanks to @ovs for pointing out the closure variant. The range (0..b'e') is collected into a vector (using the placeholder _, letting the compiler figure out the type) and printed using the debug formatter {:?}, which "dumps" the entire vector. The range upper bound is exclusive, and is represented using the byte literal b'e', which is equivalent to an u8 integer number literal; in this case 101 (e's ASCII value). • How do you get 45 bytes? Your submission has to be either a full program (like the current code at 56 bytes) or a function/closure which can be 46 bytes – ovs Oct 29, 2021 at 15:55 • I am sorry, I forgot to update the header after including fn main() { ... }. Will use the closure version. Thank you for pointing this out! Oct 29, 2021 at 16:06 # C, 53 bytes int main(a,b){for(;a^'f';a++){printf("%d\n",a-!!a);}}  Try it online! ## 43 42 bytes (Thanks to Jo King♦) k;main(){for(;k^'e';)printf("%d ",k++);}  Try it online! • Welcome to code golf, and nice first answer! Make sure to check out our tips for golfing in C to see if there's any way for you to shorten your code. Oct 29, 2021 at 13:37 # unsure, 99 bytes ummmmm uhhhh errrrr uhhh um errrrr um um yeah err heh but um yeah err then uh okay um err then wait  It's not the shortest. Explanation: push 101 ummmmm uhhhh errrrr uhhh um errrrr push 0 to other stack um um yeah err heh loop but ... wait decrement um yeah err print + increment other then uh okay um err then  • Maybe I do something wrong, but when testing it with the interpreter you linked, it only prints the numbers up to 99. Feb 28, 2021 at 3:34 • i misread the challenge, costs 4 bytes i'll fix Feb 28, 2021 at 4:08 # C - 37 Bytes i;f(){while(i<'e')printf("%d",i++);}  Ungolfed i; f() { while(i < 'e') printf("%d", i++); }  Explanation Function to print numbers from 0 to 100 without digits. A global variable of type integer is created (so that it is automatically initialized to 0), the variable is incremented and printed 100 times through a loop which is executed while the variable is less than 'e' or 101 in ASCII. # Zsh, 12 bytes seq 0$[##d]

Attempt This Online!

• seq: count
• from 0
• $[##d]: to the character value of d Alternative: # Zsh, 12 bytes ! seq 0$?00

Attempt This Online!

! does nothing, but fails with exit code 1; \$? then retrieves the exit code.

# Powershell, 18 bytes

0..[byte][char]'d'

• -5 bytes Try it online! Feb 23, 2021 at 18:12
• -9 bytes Try it online! Feb 23, 2021 at 21:25
• @ZaelinGoodman, Julian for some unknown reason I can't access TIO, I will update as soon as I can go, thanks! Feb 24, 2021 at 6:56
• @Julian Wow, nice one!! Feb 24, 2021 at 13:00

# Husk, 4 bytes

ŀc'e


Try it online!

Surprised Husk doesn't have a builtin for 100.

## How it works

ŀc'e - Main function, no arguments
'e - Character literal "e"
c   - Convert to charcode; 101
ŀ    - Lowered range; [0, 1, ..., 100]


# MATL, 65 6 bytes

O'd'&:


Try it out at MATL Online

Explanation

O     % Letter O which is a pre-defined literal for zero
'd'   % String literal, 'd' (ASCII 100)
&:    % Create an array from 0...100
% Implicitly print the result

• I think it's supposed to range from 0 to 100 -- I made the same mistake myself. Feb 24, 2021 at 12:16
• @Giuseppe Good call, I saw the 1,2,3,4,5,... in the description and got confused! Feb 24, 2021 at 14:31

# Befunge-98 (FBBI), 13 11 bytes

.0!+::'e%j@


-1 byte thanks to @ovs

-1 byte thanks to @PizgenalFilegav

Try it online!

• 'd is a byte shorter than aa*.
– ovs
Feb 23, 2021 at 18:25
• Also, using %j@ is a byte shorter than the conditional. Feb 24, 2021 at 7:00
• @ovs I forgot to look at Befunge's tips :) thanks! Feb 24, 2021 at 16:25
• @PizgenalFilegav nice catch! But I don't quite get why the jump doesn't skip the first instructions, does it reset when wrapping around? Feb 24, 2021 at 16:27
• @Cinaski I'm not completely sure either, but I think it's because Befunge-98's wrapping behavior works by backtracking until it actually reaches the opposite side of the program, and it only happens after the jump is complete. Feb 24, 2021 at 17:34

# Python 3, 96 bytes

import sys
n=0xb%0xa;m=0xa*0xa;p=lambda x:m if x>m else sys.stdout.write(str(x)+",")&p(x+n);p(n)


Try it online!

• I don't think int(...) is needed around 0xa or 0xb etc. Also, you need to include the score in the post header (the number of bytes in case of code-golf). Feb 25, 2021 at 7:14
• 65 bytes Prints newline instead of ,, and doesn't have the trailing ,. Also, your solution didn't start from 0, it started from 1`. This fixes that Feb 26, 2021 at 0:11