42
\$\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
  • 11
    \$\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
  • 7
    \$\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

114 Answers 114

116
\$\begingroup\$

R, 9 bytes

F:volcano

Try it online!

The sequence operator : coerces its arguments to integers. F is the boolean FALSE, which gets coerced to 0. volcano is one of the many built-in datasets (it gives topographic information about Maunga Whau in New Zealand); since it is a matrix, : fetches the value at position [1, 1] which is luckily equal to 100. The code is therefore equivalent to 0:100.

This answer was inspired by a conversation with Giuseppe and Kirill L. in the comments under Giuseppe's R answer.

\$\endgroup\$
8
  • 8
    \$\begingroup\$ I thought Mathematica had weird builtins. Why is volcano specifically about Maunga Whau in New Zealand? \$\endgroup\$ Feb 23 at 20:27
  • 8
    \$\begingroup\$ @cairdcoinheringaahing This dataset was digitized by Ross Ihaka, a New Zealand statistician and one of the creators of R, who then included it in R as a good example for a contour map. I don't know why he chose that volcano; maybe he lived nearby, or maybe that was just the first map he found! \$\endgroup\$ Feb 23 at 20:58
  • 3
    \$\begingroup\$ @Giuseppe I tried that, but volcano is the only dataset whose first entry is in \$[100, 101)\$. Using anything else than the first entry leads to at least 9 bytes, even for a dataset with a 3-character name (e.g. sum(BOD) or npk[pi], which don't give 100 anyway). I don't think it can get shorter using this approach. \$\endgroup\$ Feb 24 at 7:08
  • 9
    \$\begingroup\$ Not that it'd change your byte-count, but you could've just used 0 - the rules only say 1-9 are forbidden... \$\endgroup\$ Feb 24 at 21:45
  • 3
    \$\begingroup\$ Just impressed by the beauty of this answer! \$\endgroup\$
    – wasif
    Mar 7 at 16:47
27
\$\begingroup\$

Python 3: 27 23 20 Bytes

Thanks to caird coinheringaahing for -4 bytes, ovs for -3 bytes

print(*range(*b'e'))

I'm pretty poor at golfing, so there's probably a better way to do this.

TIO

\$\endgroup\$
16
  • 2
    \$\begingroup\$ Hey @DonThousand, I accidentally downvoted your submission, my bad, i was upvoting, but it was a misclick, i have fixed my mistake, sorry again. \$\endgroup\$
    – user100752
    Feb 23 at 15:55
  • 2
    \$\begingroup\$ You can replace ord('e') with *b'e' for -3 bytes. \$\endgroup\$
    – ovs
    Feb 23 at 16:01
  • 7
    \$\begingroup\$ Strings with a leading b are objects of type bytes, which behave like lists of integers in many ways. This is doing the same as range(*[101]). \$\endgroup\$
    – ovs
    Feb 23 at 16:07
  • 1
    \$\begingroup\$ Byte strings have special iteration built-in to them. This code snippet should help clarify: for char in b'hello': print(char) \$\endgroup\$ Feb 23 at 16:08
  • 1
    \$\begingroup\$ @aneroid - that would be a snippet rather than a function or program, so would need to be lambda:[*range(*b'e')] to comply with site defaults, making it longer than the full program print(*range(*b'e')). \$\endgroup\$ Feb 24 at 20:30
16
\$\begingroup\$

JavaScript (V8), 28 bytes

We cannot write \$100\$ or \$101\$ in hexadecimal with 0's and letters only (0x64 and 0x65 respectively), but we can write \$202\$ (0xCA) and use \$2n<202\$ as the condition of the for loop.

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

Try it online!


30 bytes

This version computes \$10^2\$ with the hexadecimal representation of \$10\$.

for(n=0;n<=0xA*0xA;)print(n++)

Try it online!


31 bytes

This version builds the string "100".

for(n=0;n<=-~0+'00';)print(n++)

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ The last one could be 1 byte shorter asfor(n=0;n<=0xA+'0';)print(n++). \$\endgroup\$ Feb 27 at 8:46
15
\$\begingroup\$

brainfuck, 138 bytes

>>++++++++++<<++++++[>>>++++++++<<<-]++++++[>>>>++++++++<<<<-]++++++++++>++++++++++<[>[>>.>.+<<.<-]++++++++++>>>----------<+<<<-]>>>>+.-..

Try it online!

No numbers is pretty easy, but the golf size is not great... :)

I am sure it can be improved, I am really a beginner in using Brainfuck. I wanted to try it anyway.

How it works:

>>++++++++++<<                LF Char (idx2)
++++++[>>>++++++++<<<-]       Zero char tens (idx3)
++++++[>>>>++++++++<<<<-]     Zero char unit (idx4)
+++++ +++++                   10 counter (tens)
>+++++ +++++<                 10 counter (unit)
[>                            Move to the counter
  [>>.                        Print the tens
    >.+                       Print the unit and increment
     <<.                      Print the LF
       <-]                    Loop 10 times
+++++ +++++                   Restore the counter
>>>----- -----                Restore the digit
  <+                          Increment the tens char
    <<<-]                     Loop everything 10 times
>>>>+.-..                     Print 100 using a cell which is already at char 0
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Welcome to the site, and nice first answer! \$\endgroup\$ Feb 24 at 10:09
14
\$\begingroup\$

Jelly, 2 bytes

³Ż

Try it online!

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

How it works

³ŻK - Main link. Takes no arguments
³   - Yield 100
 Ż  - Range from 0 to 100
  K - Join by spaces (optional)
\$\endgroup\$
11
  • 2
    \$\begingroup\$ wtf happens here xD \$\endgroup\$
    – azro
    Feb 23 at 18:15
  • 14
    \$\begingroup\$ Languages designed to be used in code golf kinda ruin the aesthetics of code golf. I prefer to see mad-squeezing of daily used languages that are legitimately used in real production environments, instead. \$\endgroup\$ Feb 24 at 16:07
  • 2
    \$\begingroup\$ @MartinBraun In most challenges (I.e. those more complex than this), creating a competitive answer in a golfing language is just as difficult as doing so in a “real” language. You’ll see that I helped golf the Python answer just above (sorting by votes), and I can tell you that was just as simple as writing this answer \$\endgroup\$ Feb 24 at 16:11
  • 4
    \$\begingroup\$ @MartinBraun This opinion has been shared a gazillion times on meta. The consensus is, just look at other answers. The R answer in particular is quite beautiful. \$\endgroup\$ Feb 24 at 17:16
  • 1
    \$\begingroup\$ @Sanctus It is 2 bytes. More specifically, it is the hex bytes 83 D2 (and 4B for the 3 byte version). Jelly uses a custom code page to encode its programs in order to make them more "readable", but if you fed a raw byte stream of those two bytes into the Jelly interpreter, it would produce the same output \$\endgroup\$ Feb 26 at 15:45
11
\$\begingroup\$

Retina 0.8.2, 33 26 24 bytes


,,

,,,,,,
,
,,,,,

$.`

Try it online! Explanation: The first stage inserts two commas, which the second stage increases to 20 (it's complicated). The third stage multiplies by 5 to give 100. The last stage then inserts the number of commas so far at each position.

\$\endgroup\$
3
  • \$\begingroup\$ Nice! You can golf it a bit by computing 100 as 4*5*5 tio.run/##K0otycxL/P@fSwcIuHTAFILmUtFL@P8fAA \$\endgroup\$
    – Leo
    Feb 23 at 21:49
  • 1
    \$\begingroup\$ @Leo You should have used 0514150 commas for a nice symmetry! \$\endgroup\$
    – Neil
    Feb 23 at 23:30
  • 1
    \$\begingroup\$ @Leo (Although as it happens I found a shorter solution, which I then verified using a Python script. The only other solution with the same length simply has the first two stages swapped.) \$\endgroup\$
    – Neil
    Feb 23 at 23:40
10
\$\begingroup\$

Raku, 10 bytes

put 0..Ⅽ

Try it online!

here is the Unicode character ROMAN NUMERAL ONE HUNDRED.

Any other Unicode character with a defined value of 100 could be used:

௱: TAMIL NUMBER ONE HUNDRED
൱: MALAYALAM NUMBER ONE HUNDRED
፻: ETHIOPIC NUMBER HUNDRED
ⅽ: SMALL ROMAN NUMERAL ONE HUNDRED
佰: CJK UNIFIED IDEOGRAPH-4F70
百: CJK UNIFIED IDEOGRAPH-767E
陌: CJK UNIFIED IDEOGRAPH-964C

All are three UTF-8 bytes long, like .

\$\endgroup\$
5
  • \$\begingroup\$ Anytime you have 0..foo, you can use ^foo. So you can get 8 bytes with put ^Ⅽ \$\endgroup\$ Feb 24 at 3:08
  • \$\begingroup\$ @user0721090601 Incorrect. ^foo is the same as 0..(foo-1), not 0..foo. \$\endgroup\$
    – Sean
    Feb 24 at 3:54
  • \$\begingroup\$ Ack, duh. Ignore me \$\endgroup\$ Feb 24 at 4:13
  • \$\begingroup\$ Are there any Unicode characters with a defined value of 101? If so, puts ^ then the character would save bytes \$\endgroup\$ Mar 5 at 0:51
  • \$\begingroup\$ @cairdcoinheringaahing I checked that before posting my answer, but there aren't any. Not too surprising, really. \$\endgroup\$
    – Sean
    Mar 5 at 1:02
10
\$\begingroup\$

R, 11 bytes

F:(0xA*0xA)
F:0xA^(T+T)

Try it online!

Uses this tip.

Still being beaten by some volcano in New Zealand, though...

Old answer:

R, 16 bytes

F:paste0(+T,0,0)

Try it online!

Thanks to Kirill L. for correcting an error.

R's ASCII=>byte function is utf8ToInt, which unfortunately has an 8 in it. Luckily, : will attempt to coerce its arguments to numeric types, so we construct 100 by pasting together +F (which coerces its value to 0) and two 0s. This would also work, though longer, without a 0 as F:paste(+T,+F,+F,sep="").

Possibly there's a very short builtin dataset with a sum that's close to 100, though I haven't been able to find one.

\$\endgroup\$
8
  • \$\begingroup\$ I believe according to the task, you should start with F rather than T. \$\endgroup\$
    – Kirill L.
    Feb 23 at 17:19
  • \$\begingroup\$ 9 bytes (but yours is much more elegant!) \$\endgroup\$ Feb 23 at 17:31
  • \$\begingroup\$ @KirillL. oh yes, my mistake. Thanks. \$\endgroup\$
    – Giuseppe
    Feb 23 at 17:44
  • 2
    \$\begingroup\$ @Giuseppe, yeah, but F:sum(T|Nile) is still only 13 bytes. \$\endgroup\$
    – Kirill L.
    Feb 23 at 17:48
  • 1
    \$\begingroup\$ I found out that the volcano dataset leads to a 9 byte answer, which I posted instead. \$\endgroup\$ Feb 23 at 19:34
8
+50
\$\begingroup\$

Factor, 46 23 bytes

-23 bytes thanks to Bubbler

0xa sq [0,b] [ . ] each

Try it online!

I've never written anything in Factor before, but it's a surprisingly fun language.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Thanks for picking up Factor! Lots of golfs are possible on this code. 1) You don't need to dup the 100 in the first place, and then you won't have anything to drop at the end. 2) A range is a sequence, so you can run each on it without >array. 3) There are multiple ways to get the constant 100, such as CHAR: d or 0xa sq. If you want, drop by the Factor chatroom, and I'll explain things further :) \$\endgroup\$
    – Bubbler
    Mar 2 at 8:35
7
\$\begingroup\$

Bash, 25 23 bytes

seq 0 $(printf %d "'d")

Try it online!

-2 thanks to @manatwork

\$\endgroup\$
5
  • 7
    \$\begingroup\$ Using $(..) is good coding habit, but is longer than `..`. And no need to quote ”%d” as contains nothing special. In change the “'d” contains character with special meaning, but only one, so escaping it with \ is shorter. Try it online! \$\endgroup\$
    – manatwork
    Feb 23 at 16:23
  • 1
    \$\begingroup\$ What is happening with the 'd? I assume printf is interpreting it as its ascii numeric value but I don't see it mentioned in the docs. \$\endgroup\$
    – Jonah
    Feb 23 at 16:25
  • \$\begingroup\$ @manatwork thanks! \$\endgroup\$
    – wasif
    Feb 23 at 16:27
  • 1
    \$\begingroup\$ How weird, @Jonah. I can't find where I learned about that feature. Only found in the printf specification's Examples section. Maybe Wasif knows a better documentation. \$\endgroup\$
    – manatwork
    Feb 23 at 16:35
  • 1
    \$\begingroup\$ @Jonah found it few days ago here, Actually I don't know a lot of documentation on bash \$\endgroup\$
    – wasif
    Feb 23 at 16:44
7
\$\begingroup\$

PowerShell, 16 12 bytes

-4 bytes thanks to @mazzy!

0..(0xa*0xa)

Try it online!

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Try it online! \$\endgroup\$
    – mazzy
    Feb 23 at 22:12
  • \$\begingroup\$ @mazzy thanks! I feel silly for having missed that, lol \$\endgroup\$ Feb 24 at 16:36
  • 1
    \$\begingroup\$ You beat me to it! \$\endgroup\$ Feb 25 at 15:34
7
\$\begingroup\$

Zsh, 16 bytes

echo {0..$[##d]}

Try it online!

Only builtins, so no seq


For fun, here's a 17 byte answer without 0:

echo {$?..$[##d]}

Try it online!

Also $! or $# will work as 0 replacements.

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

Shakespeare Programming Language

Novelty answer, please remove if not allowed.

Act I: The counting machine.

Scene I: Decides to study number counting.

[Enter Romeo and Juliet]

Juliet: You are as bold as the square of the sum of a mighty handsome brave king and a noble Lord.

Romeo: You are as lovely as a rose.

Scene II: Checks who is the fast learner.

Romeo: Open your heart.
Am I better than you?

Juliet: If not, let us proceed to Scene III.
You are as honest as the square root of yourself.
Speak your mind.

Romeo: You are as sweet as the sum of yourself and a plum.

Juliet: You are as gentle as the square of yourself.
Let us return to Scene II.

Scene III: Reaches an agreement.

Juliet:
You are as trustworthy as the square root of yourself.
Speak your mind.
[Exeunt]

https://www.playshakespeare.com/forum/shakespeare-programming-language

In the above example, the first statement of Juliet stores the value=100 in Romeo. Juliet moves from 1 to 100 and always compares her value with Romeo to know whether the upper limit is reached. The value of Juliet is printed. It is followed by a newline character, which is a contribution from Romeo. When the upper limit of 100 is reached the control moves to Scene III, which is the end.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Welcome to the site! This is a [code-golf] challenge, so you should aim to reduce the length of your code as much as possible (e.g. remove empty lines, use Ajax and Puck instead of Romeo and Juliet etc.) \$\endgroup\$ Feb 25 at 22:29
  • 1
    \$\begingroup\$ Great first solution! Please note that site rules say “All solutions to challenges should: (…) * Be a serious contender for the winning criteria in use. For example, an entry to a code golf contest needs to be golfed, and an entry to a speed contest should make some attempt to be fast.” — help center As far as I can tell your solution could benefit of some golfing. See Tips for golfing in The Shakespeare Programming Language \$\endgroup\$
    – manatwork
    Feb 25 at 22:31
  • 1
    \$\begingroup\$ I don't think this is entirely valid. It appears to be missing the character and program introductions header. Not sure if there is an implementation this would work with. Here is a 340 byte program using one scene and with some of the description stuff stripped out. \$\endgroup\$
    – Jo King
    Oct 7 at 22:43
7
\$\begingroup\$

PHP, 30 bytes

First time golfing, I hope I posted this right!

while($q<ord(e))echo+$q++,' ';

Try it online!


Thanks to manatwork and Dewi Morgan's suggestions to improving the code! From 34 to 30 bytes!

The code revisions are in the edit history, removed here so it looks cleaner!

\$\endgroup\$
6
  • 2
    \$\begingroup\$ Welcome to Code Golf! Nice first answer. (Don't worry, you posted it correctly :p) \$\endgroup\$ Feb 24 at 6:07
  • 1
    \$\begingroup\$ Unfortunately your solution doesn't output 0. While fixing it, you could reduce its size by removing the single quotes, the braces and the parenthesis around echo's argument. I would suggest this: Try it online! \$\endgroup\$
    – manatwork
    Feb 24 at 6:08
  • 1
    \$\begingroup\$ Nice! The space before quotes can go, too :) \$\endgroup\$ Feb 25 at 16:35
  • 1
    \$\begingroup\$ Thinking about it, you can also get rid of the third clause if you postincrement and concatenate the variable to the space : `for($q=0;$q<ord(e);)echo$q++." "; Shame none of the permitted separators are characters so they could be unquoted. \$\endgroup\$ Feb 25 at 16:50
  • 1
    \$\begingroup\$ And we only need the 4 chars $q=0 because null isn't being cast to an int. We can cast to an int to avoid it, but (int) takes 5 bytes. But adding 0 casts to 0, and we can only do that in 2 bytes, though we need to re-add the space after the echo, so it's effectively 3. Still saves us a byte, though! while($q<ord(e))echo 0+$q++." "; (while has the same bytecount as for with just the middle clause used). \$\endgroup\$ Feb 25 at 17:22
6
\$\begingroup\$

GNU Octave, 14, 5 bytes

0:'d'

TIO by Giuseppe

\$\endgroup\$
3
  • \$\begingroup\$ I think just 0:'d' should work. \$\endgroup\$
    – Giuseppe
    Feb 23 at 16:14
  • \$\begingroup\$ @Giuseppe: nice one \$\endgroup\$
    – Thor
    Feb 23 at 16:17
  • 2
    \$\begingroup\$ Also, Octave is on TIO if you want to add a link :-) \$\endgroup\$
    – Giuseppe
    Feb 23 at 16:19
6
\$\begingroup\$

Ruby 22 bytes 12 bytes - thanks to @manatwork

p *0..?d.ord

Try it online!

\$\endgroup\$
3
  • 1
    \$\begingroup\$ A splat * operator will do it instead of .to_a: p *0..?d.ord \$\endgroup\$
    – manatwork
    Feb 23 at 16:00
  • \$\begingroup\$ thanks @manatwork \$\endgroup\$
    – user100752
    Feb 23 at 16:05
  • 2
    \$\begingroup\$ You can switch to Ruby 1.8 and remove the .ord \$\endgroup\$
    – pxeger
    Feb 23 at 20:02
6
\$\begingroup\$

05AB1E, 2 bytes

тÝ

Try it online!

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

How it works

тÝ» - Full program
т   - Push 100
 Ý  - Range from 0 to 100
  » - Join with newlines (optional)
\$\endgroup\$
6
\$\begingroup\$

Vyxal, jH, 1 byte

ʀ

Try it Online!

Flags for the win. The H flag presets the stack to 100, generate range 0 to 100 and then j flag joins on newlines. The flag was around before this challenge too.

\$\endgroup\$
3
  • \$\begingroup\$ This seems to give the wrong output \$\endgroup\$
    – Anush
    Feb 23 at 22:00
  • \$\begingroup\$ @Anush its fixed \$\endgroup\$
    – lyxal
    Feb 24 at 1:53
  • \$\begingroup\$ +1, first reaction someone seeing this will be "OMGWTFBBQ wat happens here" XD \$\endgroup\$
    – wasif
    Jun 7 at 12:19
6
\$\begingroup\$

C (gcc), 38 bytes

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

Try it online!

Without using digit 0, it would be 39 bytes: i;main(){for(;printf("%d ",i++)&'#';);}

\$\endgroup\$
5
  • \$\begingroup\$ i as a global defaults to 0 saving a couple characters. Just change your main call to f in your example/ \$\endgroup\$ Feb 24 at 20:58
  • \$\begingroup\$ Actually took I it further and made it recursive for a 2 more characters saved: \$\endgroup\$ Feb 24 at 21:10
  • \$\begingroup\$ where did you learn this level of programming i don't even understand it \$\endgroup\$ Feb 25 at 7:59
  • 1
    \$\begingroup\$ @vijaykumar printf returns how many bytes are printed. '#' is as same as number 35 (ASCII 35 for "#"). That's all you need to know to make it work. \$\endgroup\$
    – tsh
    Feb 25 at 8:08
  • \$\begingroup\$ Capital C would also work - 64+3 = 'C' :) \$\endgroup\$ Feb 25 at 19:21
6
\$\begingroup\$

Perl, 20, 13, 12, 16 bytes

say for 0..ord d 

Try it online!

\$\endgroup\$
6
  • \$\begingroup\$ You can get rid of $,=",";, but you need ord('d') for it to work. \$\endgroup\$ Feb 23 at 16:03
  • 1
    \$\begingroup\$ @PaulPicard: unquoted dee works here (perl v5.32.0), e.g. perl -E 'say 0..ord(d)' \$\endgroup\$
    – Thor
    Feb 23 at 16:08
  • 2
    \$\begingroup\$ You can remove the parenthesis. \$\endgroup\$
    – manatwork
    Feb 23 at 16:11
  • \$\begingroup\$ Without the comma, this doesn't meet the challenge specification to have a separator between numbers. say for 0..ord d would meet the rules. \$\endgroup\$
    – Xcali
    Feb 24 at 0:01
  • \$\begingroup\$ @Xcali: indeed, thanks \$\endgroup\$
    – Thor
    Feb 24 at 5:18
6
\$\begingroup\$

Deadfish~, 2071 / 8 / 7 bytes

2071 bytes

o{i}c{d}io{i}dc{d}iio{i}ddc{d}iiio{i}dddcddddddoiiiiiicdddddoiiiiicddddoiiiicdddoiiicddoiicdoicociodciioddciiiodddciiiioddddciiiiiodddddciiiiiioddddddc{i}dddo{d}iiic{i}ddo{d}iic{i}do{d}ic{i}o{d}c{i}io{d}dc{i}iio{d}ddc{i}iiio{d}dddc{i}iiiio{d}ddddc{i}iiiiio{d}dddddc{i}iiiiiio{d}ddddddc{i}{i}dddo{d}{d}iiic{i}{i}ddo{d}{d}iic{i}{i}do{d}{d}ic{i}{i}o{d}{d}c{i}{i}io{d}{d}dc{i}{i}iio{d}{d}ddc{i}{i}iiio{d}{d}dddc{i}{i}iiiio{d}{d}ddddc{i}{i}iiiiio{d}{d}dddddc{i}{i}iiiiiio{d}{d}ddddddc{i}{i}{i}dddo{d}{d}{d}iiic{i}{i}{i}ddo{d}{d}{d}iic{i}{i}{i}do{d}{d}{d}ic{i}{i}{i}o{d}{d}{d}c{i}{i}{i}io{d}{d}{d}dc{i}{i}{i}iio{d}{d}{d}ddc{i}{i}{i}iiio{d}{d}{d}dddc{i}{i}{i}iiiio{d}{d}{d}ddddc{i}{i}{i}iiiiio{d}{d}{d}dddddc{i}{i}{i}iiiiiio{d}{d}{d}ddddddc{{i}dddddd}dddo{{d}iiiiii}iiic{{i}dddddd}ddo{{d}iiiiii}iic{{i}dddddd}do{{d}iiiiii}ic{{i}dddddd}o{{d}iiiiii}c{{i}dddddd}io{{d}iiiiii}dc{{i}dddddd}iio{{d}iiiiii}ddc{{i}dddddd}iiio{{d}iiiiii}dddc{{i}dddddd}iiiio{{d}iiiiii}ddddc{{i}dddddd}iiiiio{{d}iiiiii}dddddc{{i}dddddd}iiiiiio{{d}iiiiii}ddddddc{{i}ddddd}dddo{{d}iiiii}iiic{{i}ddddd}ddo{{d}iiiii}iic{{i}ddddd}do{{d}iiiii}ic{{i}ddddd}o{{d}iiiii}c{{i}ddddd}io{{d}iiiii}dc{{i}ddddd}iio{{d}iiiii}ddc{{i}ddddd}iiio{{d}iiiii}dddc{{i}ddddd}iiiio{{d}iiiii}ddddc{{i}ddddd}iiiiio{{d}iiiii}dddddc{{i}ddddd}iiiiiio{{d}iiiii}ddddddc{{i}dddd}dddo{{d}iiii}iiic{{i}dddd}ddo{{d}iiii}iic{{i}dddd}do{{d}iiii}ic{{i}dddd}o{{d}iiii}c{{i}dddd}io{{d}iiii}dc{{i}dddd}iio{{d}iiii}ddc{{i}dddd}iiio{{d}iiii}dddc{{i}dddd}iiiio{{d}iiii}ddddc{{i}dddd}iiiiio{{d}iiii}dddddc{{i}dddd}iiiiiio{{d}iiii}ddddddc{{i}ddd}dddo{{d}iii}iiic{{i}ddd}ddo{{d}iii}iic{{i}ddd}do{{d}iii}ic{{i}ddd}o{{d}iii}c{{i}ddd}io{{d}iii}dc{{i}ddd}iio{{d}iii}ddc{{i}ddd}iiio{{d}iii}dddc{{i}ddd}iiiio{{d}iii}ddddc{{i}ddd}iiiiio{{d}iii}dddddc{{i}ddd}iiiiiio{{d}iii}ddddddc{{i}dd}dddo{{d}ii}iiic{{i}dd}ddo{{d}ii}iic{{i}dd}do{{d}ii}ic{{i}dd}o{{d}ii}c{{i}dd}io{{d}ii}dc{{i}dd}iio{{d}ii}ddc{{i}dd}iiio{{d}ii}dddc{{i}dd}iiiio{{d}ii}ddddc{{i}dd}iiiiio{{d}ii}dddddc{{i}dd}iiiiiio{{d}ii}ddddddc{{i}d}dddo{{d}i}iiic{{i}d}ddo{{d}i}iic{{i}d}do{{d}i}ic{{i}d}o{{d}i}c

Try it online!

8 bytes (if you consider Hello, world! a valid separator)

o{{iow}}

Try it online!

7 bytes (If you don't care about seperators)

o{{io}}

Try it online!

Never thought I'd see deadfish be shorter than, well, anything except Unary.

\$\endgroup\$
4
  • \$\begingroup\$ Damn it. Rewriting. \$\endgroup\$
    – emanresu A
    Feb 24 at 3:30
  • \$\begingroup\$ @Razetime Remebered w doesn't care about accumulator. \$\endgroup\$
    – emanresu A
    Feb 24 at 3:32
  • \$\begingroup\$ "Hello, World!" is not a valid separator. \$\endgroup\$ Feb 24 at 4:10
  • 1
    \$\begingroup\$ Haha reading up on Deadfish~ I realized that exact 7 byte program... but you beat me to it! I actually wrote a Deadfish interpreter for Code Golf that automatically had spaces between output, just because the BASIC interpreter put them there. 😄 Perfect for than program! \$\endgroup\$ Mar 7 at 16:30
6
\$\begingroup\$

Bash, 18 16 14 bytes

seq 0 $[++x]00

Try it online!

Thanks @manatwork for -2, @Jonah for -2

\$\endgroup\$
5
  • \$\begingroup\$ You don't need the braces. \$\endgroup\$
    – manatwork
    Feb 27 at 2:53
  • \$\begingroup\$ Welcome to Code Golf! Nice first answer. \$\endgroup\$ Feb 27 at 4:14
  • \$\begingroup\$ Thanks @manatwork \$\endgroup\$
    – David
    Feb 27 at 4:22
  • \$\begingroup\$ seq 0 $[++x]00 for 14. \$\endgroup\$
    – Jonah
    Feb 28 at 3:43
  • 1
    \$\begingroup\$ Thanks @Jonah ! \$\endgroup\$
    – David
    Feb 28 at 5:35
6
\$\begingroup\$

SHENZHEN I/O, 61 bytes, 7¥, 7 Lines

@not
@mov acc dat
@not
tgt acc dat
-mov acc p0
-add x0
slp x0

Outputs 0-100 as simple output, one per time unit. Makes use of the DX300 (XBus <-> Simple Input chip) and LC70G04 (NOT gate), which cost 1¥ each but do not use any power or count as lines of code (the game's measure of code length). These are used to generate a value of 1, which it adds and outputs until it hits 100. The value for 100 is generated using the "not" command, which makes the accumulator 100 if it is value 0, otherwise it sets the acc to 0.

(Not pictured: conversion from simple output to the screen's XBus input, for the visualization.)


SHENZHEN I/O (MCxxxx ASM only), 129 bytes, 8¥, 16 Lines

@not                 | not
@mov acc p0          | mul acc
@mov acc dat         | dgt 0
@not                 | sub p0
add p0               | dgt 0
tgt acc dat          | mul acc
-mov acc x0          | mov acc p0
slp p0               | slx x0

Outputs 0-100 as one XBus output each. Uses only programmable MCxxxx chips, no logic gates or other components. Generates value 1 in a pretty interesting way:

not     # acc = 100
mul acc # 100 * 100 = 999 (max value)
dgt 0   # digit 0 of 999 = 9
sub p0  # 9 - 100 = -91
dgt 0   # digit 0 of -91 = -1
mul acc # -1 * -1 = 1

enter image description here

\$\endgroup\$
6
\$\begingroup\$

Wolfram Language (Mathematica), 15 14 11 bytes

=Range[0,LL

-1 byte from Imanton1

Mathematica interprets the = prefix as a call to Wolfram Alpha (auto-converting it to the orange glyph seen below), which in turn interprets "LL" as a Roman numeral for 100. I used "LL" because this doesn't work with the shorter "C".

enter image description here

\$\endgroup\$
1
  • 1
    \$\begingroup\$ You can shave off a byte, since WA uses free-form input, you can drop off the final closing bracket and it can still figure it out. =Range[0,hecto \$\endgroup\$ Oct 17 at 18:36
5
\$\begingroup\$

Lua (34 30 bytes)

for i=0,0xA*0xA do print(i)end
\$\endgroup\$
1
5
\$\begingroup\$

AWK, 26 bytes

{for(;a<=0xa*0xa;)$a=a++}a

Try it online!

Thanks to xnor for pointing out a brainfart (since fixed) in the original

This works by using 0xa*0xa to compute 100, then assigns each positional variable to it's own sequential number. Then the a without a code block (evaluates as truthy since a is 100) prints all the positional arguments separated by a space.

To be honest, I'm not 100% sure why the 0 prints but it does. :)

\$\endgroup\$
3
  • 2
    \$\begingroup\$ I don't think that the 1 is allowed unfortunately \$\endgroup\$
    – xnor
    Feb 26 at 17:34
  • \$\begingroup\$ Wow, that was dumb. :) Thanks! The fix was simple enough and didn't change the length of the code, \$\endgroup\$
    – cnamejj
    Feb 26 at 19:37
  • 1
    \$\begingroup\$ Why the zero prints: tio.run/##SyzP/v@/Oi2/… \$\endgroup\$ Feb 28 at 11:36
5
\$\begingroup\$

MATLAB, 13 bytes

0:double('d')

The ASCII code for lowercase d is 100, so convert to a double and go from 0 in intervals of 1 with ":"

\$\endgroup\$
1
  • \$\begingroup\$ Welcome to the site, and nice first answer! \$\endgroup\$ Feb 26 at 20:47
5
\$\begingroup\$

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)
\$\endgroup\$
2
  • \$\begingroup\$ Your 50 bytes solution doesn't output 0. To fix it just remove that unnecessary pre-incrementation and change the "d" to "e". \$\endgroup\$
    – manatwork
    Feb 27 at 22:22
  • \$\begingroup\$ @manatwork i thought we didnt have to print 0, at the time i wrote the solution. I'll fix it :) thanks \$\endgroup\$
    – user100752
    Feb 28 at 16:52
5
\$\begingroup\$

dc, 13 characters

Thanks to

  • Daemon for reusing stack depth instead of getting it again, to use shorter operator (-1 character)
[zpdA0>x]dsxx

Try it online!

dc, 14 characters

Thanks to

  • Digital Trauma for the twist in using the stack depth efficiently (-2 characters)
[zpzA0!<m]dsmx

Try it online!

dc, 16 characters

0[pz+dA0>i]dsixp

Sample run:

bash-5.0$ dc -e '0[pz+dA0>i]dsixp' | head
0
1
2
3
4
5
6
7
8
9

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Similar idea, same score \$\endgroup\$ Feb 23 at 20:41
  • 1
    \$\begingroup\$ Thanks @DigitalTrauma. I tried that too earlier, but only now, seeing your suggestion I found the more efficient way. \$\endgroup\$
    – manatwork
    Feb 23 at 20:54
4
\$\begingroup\$

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!

\$\endgroup\$

Your Answer

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