# 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 at 17:08
• I thought "do X without Y" questions weren't allowed anymore. Feb 24 at 3:34
• @PurpleP They're allowed, but discouraged. Interesting ones are fine. Feb 25 at 0:06
• Is there a requirement to stop printing at 100? Feb 25 at 16:44
• Can we do it in reverse order?
– Dion
Oct 16 at 9:51

# Shakespeare Programming Language, 218 bytes

,.Puck,.Ajax,.Act I:.Scene I:.[Exeunt][Enter Puck and Ajax]Puck:Open heart.You is the sum ofyou a cat.Ajax:You is twice the sum ofa big big cat a cat.Speak mind!You is the square ofyou.Is I nicer you?If notlet usAct I.


Try it online!

This is a golfed version based off of Dr Lemniscate's answer, with several non-trivial modifications, such as using only one Scene and not initialising characters. This also includes the character and program introduction section, which was neglected.

### Explanation

,.Puck,.Ajax,.Act I:.Scene I:.     # Introduce the characters and the play itself.
[Exeunt][Enter Puck and Ajax]      # Enter the main characters
Puck: Open heart.                  # Print Ajax's value as a number
You is the sum ofyou a cat.  # And increment it
Ajax: You is twice the sum ofa big big cat a cat.      # Set Puck to 2*(8+2)=10
Speak mind!                  # Print as a character (a newline)
You is the square ofyou.     # Square the value to 100
Is I nicer you?              # Compare the value against Ajax's
If notlet usAct I.           # And loop if the value is <= 100


# JavaScript (V8), 52 39 bytes

for(i=0;!print(i)>=~-(''+i++).length;);


Try it online!

Thanks Jo king

# JavaScript (V8), 52 48 bytes

for(i=0;i<=(c="    ".length)*-~c*-~c;)print(i++)


Try it online!

Not the shortest by any margin

# Explanation :

for(i = 0; // simple for loop
i <= (c="    ".length)*~-c*~-c;
// c = "    ".length ---> 4
// * -~c * -~c       ---> -~c => 5 => 4 * * 5 * 5 ==> 100
;)print(i++)          ---> end for loop and print i, then increment by 1


# JavaScript (V8), 47 bytes

_=>[...Array((c="    ".length)*-~c*-~c).keys()]


Try it online!

That prints up to 99 for 51 bytes,

_=>[...Array((c="     ".length)**~-~-c-c*c).keys()]


Prints upto 100 but byte count is 54.

# 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 at 13:37

# 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 at 8:50

# AWK, 3534 31 bytes

END{for(i;i<=0xA**2;)print i++}


Try it online!

-1 byte thanks to me

-3 bytes thanks to @cnamejj

• You can remove the i=0 statement since AWK uses an initial value of 0 for any variable use in a mathematical expression before it's set. Nov 8 at 8:53
• And 0xA**2 saves another byte. (I tried to edit the previous comment but wasn't able too since more than 5 mins had passed.) Nov 8 at 9:00

# 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 at 20:23

# CJam, 6 bytes

'ei,:p


Try it online!

### How it works

'e    e# Push character "e" (which has code point 101)
i     e# Convert to integer. Gives 101
,     e# Range (non-inclusive, starting at 0). Gives [0 1 2 ... 100]
:p    e# For each entry: print with newline


# Pyth, 9, 8, 5 bytes

@hakr46's solution

Uh*TT


Try it online!

original:

U+*TT^Z


Try it online!

Outputs a list. If the separator must be a single character, 11 bytes 6 bytes

My first golf. Pretty happy about it! Makes use of the fact that anything to the power of 0 is 1.

-3/5 bytes thanks to @hakr46 :D

• Pyth has an increment instruction, h. Also, separating a list by newlines is done with j with only one argument. These let you save 3 bytes to output the list or 5 bytes to output each number with a single character separator. Feb 23 at 18:25
• pyth.herokuapp.com's interpreter doesn't work anymore, but it still has searchable documentation, so I like to keep it open when golfing Pyth. Feb 23 at 18:27
• thanks @hakr14! Feb 23 at 19:18
• @hakr14 May I introduce you to pythtemp.herokuapp.com Interpreter that works WITH documentation Feb 26 at 0:43
• @Scott :O thank you so much... Feb 26 at 1:12

# F# (.NET Core), 35 bytes

Seq.iter(printfn"%A"){0..(int 'd')}


Try it online!

(Too bad it wasn't only to 99, could have gotten rid of the Seq.iter due to printing truncation...)

# BRASCA, 9 bytes

Hr,n[lon]


Try it online!

## Explanation

Hr         - Push range(0,100)
,        - Reverse stack
n       - Print the 0
[   ]  - While not zero:
lon   -    Print a newline and the next number


# PHP, 29 bytes

<?=join(',',range(0,ord(d)));


Explanation

ord(d) // return integer value of ASCII character 'd'
range  // create array from A to B, inclusive
join   // glue array values together using comma as separator
<?=    // output


Try it online!

# C (gcc), 35 bytes

f(i){printf("%d ",i)&'#'?f(++i):0;}


Try it online!

Let's go recursively!

• Function submission had to be reusable. So invoke f() the second time should print 0~100 again.
– tsh
Feb 25 at 10:45
• Would somebody smarter than me explain how this knows to stop counting? Feb 25 at 16:04
• @MichaelStern - printf returns the number of characters printed - when we print 100, it returns 3. '#' is ASCII 35. 3 & 35 == false; This would work with any power of 2 value + 3 (lowest 2 bits set) - 3, 7, 11, 19, 35, 67, 131, etc. So, 'C' would also work. Feb 25 at 19:18

# Tcl, 38 bytes

puts 0
time {puts [incr i]} [incr u]00


Try it online!

• Unfortunately it is not 1 to 100. I could do it even cheaper: tio.run/##K0nO@f@/JDM3VaG6oLSkWCE6My@5SCEzthbKKo01MPj/HwA Feb 25 at 20:12
• I was about to suggest the code from your comment plus a lame puts 0. Still shorter. Feb 25 at 20:18
• @manatwork: Yes it is shorter, thanks. Feb 25 at 20:23

# T-SQL, 65 64 bytes

SELECT number FROM spt_values WHERE number<ASCII('e')AND'P'=type


The master database on any SQL server contains a system table called spt_values that (among other things) contain the numbers 0 to 2047. To cap the output I used ASCII('e'), which is 101.

Let me know if you know of a shorter way to generate the number 100 or 101.

• Can't ) touch the AND keyword just as ' touches it? Because rewriting the expression as number<ASCII('e')AND'P'=type could save 1 character. Feb 25 at 21:17
• Yep, that rearrangement works, @manatwork. Thanks! Feb 25 at 21:27

# Java (JDK), 71 bytes

v->java.util.stream.IntStream.range(0,'e').forEach(System.out::println)


Try it online!

• 48 bytes Feb 25 at 17:41
• Also, you answer as it is is neither a full program, a function nor a lambda, so it's actually invalid. Feb 25 at 17:44
• Ah that's how java answers are considered? thanks
– Cray
Feb 26 at 6:17
• Well, then make a full program, a function or a lambda instead, and your answer will become valid and will be upvoted. An example is the first comment I gave, which uses a for-loop. You might want to check it out to see how we use lambdas here Feb 26 at 8:13
• Because it's a lambda. Lambdas can be used as .doSomething(v->{...}). So the Type name =  form i not specific to the lambda. What is specific to the lambda is the param -> ..., hence the wide usage of lambdas in Java answers here on codegolf. Feb 26 at 9:57

# Erlang (escript), 42 bytes


main([])->io:write(lists:seq(0,hd("d"))).


Try it online!

# JavaScript Browser, 37 characters

alert([...Array(0xB0F-0xAAA).keys()])


## But Arnaulds(https://codegolf.stackexchange.com/users/58563/arnauld) idea would be the faster way for browser js too (28)

for(n=0;n+n<0xCA;)alert(n++)

• Welcome to Code Golf! Nice first answer. I've never seen that trick with .keys() before! Feb 27 at 21:49
• @RedwolfPrograms, so you missed EliteDaMyth's solution? Feb 27 at 22:17
• @manatwork It seems I did, yeah :p Feb 27 at 22:29

## Atari 600XL, 22 bytes

Sorry I overread that it's not allowed to use the characters 1-9.

I think it is really stupid to say my language can this is a shorter way, because every language today contains more than a bunch of foreign frameworks. IMHO this "bytes" should be added to the real bytes you need to print values from 0 to 100 on the screen. Therefore a good old Atari 600XL with 16kib of RAM only need: 22 bytes. No other Software is need everything is build in.

Switch the hardware on, wait 2-3sec and type: f.a=0toasc("d"):?a:n.a

'f.' is an allowed shortcut for 'for' and 'n.' is a shortcut for 'next'

Maybe the C64 need also such less bytes.

Everything else need megabytes of extra hidden bytes.

JM2C

• Interesting point. It's easy to make a ridiculously complex instruction set language where every unicode character maps to a function, so something like C triggers a routine to output 0-100, and have a 1 byte program hiding behind a vast software library. In fairness though, even the BASIC example does rely on the interpreter built into ROM, so it IS accessing something else, as is everything except machine code. Of course, back in the 8-bit days code-golf wasn't a game - it was standard practise - you had to be clever with the memory. No importing standard libraries using hundreds of MB! Mar 2 at 4:05

# BASIC, 32 27 bytes

for a=0 to asc("d"):?a:next


Try it online!

while(a<asc("e")):?a:a=a+!0:wend

Of course, a FOR loop is shorter than using WHILE. Thanks Lars for your example.

My earlier (apparently invalid) attempt, which got downvoted for not stopping at 100:

0 ?a:a=a+!0:goto 0


Try it online!

I'll leave it here for completeness - only 18 bytes though.

Now this is not going to beat some volcano in New Zealand either... that said, it would work on 8-bit computers where the entire language interpreter was on a ROM that might be 2-16 KILObytes for the whole thing. Every bytes counted (like code golf) - there certainly wasn't space to add topographical data for the developer's favourite mountain range. 😂

# Forth, 30 bytes

char e false [do] [i] . [loop]


Try it online!

commented:

char e \ ascii value 101
false \ 0
[do] \ loop a fixed number of times
[i] \ retrieve the iterator value
. \ print the top of the stack as a number, followed by a space
[loop] \ end of loop

• You can use 'e instead of char e, and 0 is allowed in the challenge. Mar 7 at 23:48
• @Bubbler 'e isn't standard. I already made another post that uses zero. Mar 7 at 23:58
• Our current site culture is that a language's standard doesn't matter much in code golf. It just matters whether the code works in at least one existing implementation of the language (in this case it works in gforth, at least). For example, tips for golfing in C has tons of compiler-specific hacks. But it's fine to stick with the standards, as long as you mention in the post that you're restricting yourself to standard features (otherwise you'll likely get similar comments). Mar 8 at 0:09

# Forth, 26 bytes

char e 0 [do] [i] . [loop]


Try it online!

commented:

char e \ ascii value 101
0
[do] \ loop a fixed number of times
[i] \ retrieve the iterator value
. \ print the top of the stack as a number, followed by a space
[loop] \ end of loop

• I didn't really mean to, I just hit post and apperently I already did somehow? Mar 8 at 0:36

# CSASM v2.2.1.2, 143 bytes

func main:
.local a : obj
push 0
pop a
inc a
inc a
push a
inc a
inc a
inc a
push a
mul
dup
mul
pop a
lda 0
.lbl a
inc $a push$a
dup
print.n
push a
sub
brtrue a
ret
end


Commented and ungolfed:

func main:
.local onehundred : obj

; Calculate 100
push 0
pop onehundred
inc onehundred
inc onehundred
push onehundred
; Stack: [ 2 ]
inc onehundred
inc onehundred
inc onehundred
push onehundred
; Stack: [ 2, 5 ]
mul
; Stack: [ 10 ]
dup
; Stack: [ 10, 10 ]
mul
; Stack: [ 100 ]
pop onehundred

lda 0
.lbl loop
; Print $a inc$a
push $a dup print.n ; Zero is falsy. Check if$a - 100 == 0
push onehundred
sub
brtrue loop
ret
end


# Kotlin, 42 bytes

It ain't much but it's honest work

fun main(){for(i in 0..0xa*0xa)println(i)}


Try it online!

# Excel, 2322 23 bytes

=SEQUENCE(CODE("e"),,0)


## Invalid Change

=SEQUENCE(CODE("e"))-1

• There's a forbidden 1 in your code. The original one is fine. Jul 8 at 9:50
• @Dorian, This is a fine example of me thinking I'm clever when I am being stupid. Thanks for keeping me honest. Jul 8 at 15:32
• How about =SEQUENCE(ROW(),,0) in A101? Oct 25 at 18:57

# Vim, 16 bytes

i0<Esc><C-a>s<C-r>=r    <C-r>"0<C-r>")



Try it online!

Explanation:

i0<Esc>                                 # Insert 0
<C-a>                            # Increment
s                           # Delete into register " and Insert
<C-r>=                     # Start expression
r                    # Tab-autocomplete range(
<C-r>"          # 1
0         # 0
<C-r>"   # 1
)  # Full expression is range(101)
# Insert the range [0..101)


Alternatively (and more interesting, imo):

# Vim, 18 bytes

iYp<C-v><C-a>0<Esc>d^@=!0
00@-


Try it online!

Explanation:

iYp<C-v><C-a>0<Esc>        # Insert Yp<C-a>0
d^      # Delete Yp<C-a>
@-                       # Execute Yp<C-a>... times
@=!0  #                  1
00                         #                   00


# Java 106 bytes

class p {public static void main(String[] args){int i='A'/'A';while(i<=(int)'d')System.out.println(i++);}}}}


TIO

• can't say about size but yeah logic sorta be cool. :) Oct 22 at 13:12
• Welcome to Code Golf, and nice first answer! Don't worry about the size, as long as there's an attempt to golf it as much as you can, pretty much any serious answer is accepted here. :) After all, we allow answers in Unary, which typically has answers in the hundreds of thousands of bytes or more! Oct 22 at 13:25
• You can check out the tips for golfing in Java if you want, but this looks pretty good! I edited it a tiny bit to use code block formatting. Oct 22 at 13:29
• 94 bytes Oct 24 at 6:49

# Oracle SQL, 56 bytes

select level-cos(0)from dual connect by level<ascii('f')


Try it online!

# JavaScript (V8), 30 bytes

for(i=0;+!print(i)+'00'-i++;);


Try it online!

Jo king saves more bytes that I can count :)

# !@#$%^&*()_+, 13 bytes e($!#^$_^_ @)  Try it online! Explaination: e($!#^$_^_ @) e Pushes 101 onto the stack ( While$          Swap
!#        Output number without popping and newline
^       Top of stack = Top of stack + 1
\$      Swap
_^_   Top of stack = Top of stack - 1
<newline>    Push 10
@            Output top of stack as ASCII and pop
)           Close while


# Labyrinth, 18 bytes

0) @
0 \(
)#":
(!


Try it online!

Push 101 () is increment and 0 is "append zero" command), and run "print stack height - 1, dup, decrement" until the top becomes zero.

# Labyrinth, 19 bytes

0)
0
)}:!
" \
@({)


Try it online!

Keep track of two values a=0 and b=101, print a and increment and decrement b until b becomes zero.

• 17 bytes and alternative. There's probably another byte to be saved?
– Jo King
Oct 29 at 9:44
• Ah, 16 bytes with termination by division by zero
– Jo King
Oct 29 at 9:59