76
\$\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.

Kai Burghardt
1,2042 gold badges11 silver badges15 bronze badges
asked Feb 23, 2021 at 15:32
\$\endgroup\$
7
  • 16
    \$\begingroup\$ Many tricks are made possible by allowing 0. Which is what makes this challenge interesting, IMO. \$\endgroup\$ Commented Feb 23, 2021 at 17:08
  • 3
    \$\begingroup\$ I thought "do X without Y" questions weren't allowed anymore. \$\endgroup\$ Commented Feb 24, 2021 at 3:34
  • 5
    \$\begingroup\$ @PurpleP They're allowed, but discouraged. Interesting ones are fine. \$\endgroup\$ Commented Feb 25, 2021 at 0:06
  • 19
    \$\begingroup\$ Is there a requirement to stop printing at 100? \$\endgroup\$ Commented Feb 25, 2021 at 16:44
  • 2
    \$\begingroup\$ Can I use non-ASCII encoding? \$\endgroup\$ Commented Oct 17, 2021 at 20:36

180 Answers 180

1
2 3 4 5 6
146
\$\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.

answered Feb 23, 2021 at 19:33
\$\endgroup\$
8
  • 15
    \$\begingroup\$ I thought Mathematica had weird builtins. Why is volcano specifically about Maunga Whau in New Zealand? \$\endgroup\$ Commented Feb 23, 2021 at 20:27
  • 14
    \$\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\$ Commented Feb 23, 2021 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\$ Commented Feb 24, 2021 at 7:08
  • 10
    \$\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\$ Commented Feb 24, 2021 at 21:45
  • 4
    \$\begingroup\$ Just impressed by the beauty of this answer! \$\endgroup\$ Commented Mar 7, 2021 at 16:47
39
\$\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

answered Feb 23, 2021 at 15:45
\$\endgroup\$
15
  • 2
    \$\begingroup\$ 23 bytes \$\endgroup\$ Commented Feb 23, 2021 at 15:53
  • 3
    \$\begingroup\$ You can replace ord('e') with *b'e' for -3 bytes. \$\endgroup\$ Commented Feb 23, 2021 at 16:01
  • 9
    \$\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\$ Commented Feb 23, 2021 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\$ Commented Feb 23, 2021 at 16:08
  • 2
    \$\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\$ Commented Feb 24, 2021 at 20:30
21
\$\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 \2ドルn<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!

answered Feb 23, 2021 at 16:53
\$\endgroup\$
1
  • 1
    \$\begingroup\$ The last one could be 1 byte shorter asfor(n=0;n<=0xA+'0';)print(n++). \$\endgroup\$ Commented Feb 27, 2021 at 8:46
21
\$\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
answered Feb 24, 2021 at 9:36
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Welcome to the site, and nice first answer! \$\endgroup\$ Commented Feb 24, 2021 at 10:09
18
\$\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

answered Mar 6, 2021 at 3:16
\$\endgroup\$
1
  • \$\begingroup\$ Nice to see a little more Shenzen I/O rep around here! \$\endgroup\$ Commented Mar 20 at 10:06
18
\$\begingroup\$

Vyxal jHRM, 0 bytes


Try it Online!

Kinda cheating, but whatever.

How?

 # full program
 # H flag presets the stack to 100
 # R flag does range when number is treated as iterable
 # M flag makes range start at 0
 # j flag joins the top of the stack by newlines
answered May 12, 2022 at 4:08
\$\endgroup\$
17
\$\begingroup\$

Jelly, 2 bytes

Try it online!

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

How it works

3ŻK - Main link. Takes no arguments
3 - Yield 100
 Ż - Range from 0 to 100
 K - Join by spaces (optional)
answered Feb 23, 2021 at 15:49
\$\endgroup\$
11
  • 5
    \$\begingroup\$ wtf happens here xD \$\endgroup\$ Commented Feb 23, 2021 at 18:15
  • 20
    \$\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\$ Commented Feb 24, 2021 at 16:07
  • 4
    \$\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\$ Commented Feb 24, 2021 at 16:11
  • 8
    \$\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\$ Commented Feb 24, 2021 at 17:16
  • 3
    \$\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\$ Commented Feb 26, 2021 at 15:45
16
\$\begingroup\$

Raku, 10 bytes

put 0..C

Try it online!

C 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
c: 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 C.

answered Feb 23, 2021 at 18:10
\$\endgroup\$
5
  • \$\begingroup\$ Anytime you have 0..foo, you can use ^foo. So you can get 8 bytes with put ^C \$\endgroup\$ Commented Feb 24, 2021 at 3:08
  • \$\begingroup\$ @user0721090601 Incorrect. ^foo is the same as 0..(foo-1), not 0..foo. \$\endgroup\$ Commented Feb 24, 2021 at 3:54
  • \$\begingroup\$ Ack, duh. Ignore me \$\endgroup\$ Commented Feb 24, 2021 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\$ Commented Mar 5, 2021 at 0:51
  • \$\begingroup\$ @cairdcoinheringaahing I checked that before posting my answer, but there aren't any. Not too surprising, really. \$\endgroup\$ Commented Mar 5, 2021 at 1:02
14
\$\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.

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

answered Feb 23, 2021 at 17:59
\$\endgroup\$
6
  • \$\begingroup\$ Nice! You can golf it a bit by computing 100 as 4*5*5 tio.run/##K0otycxL/P@fSwcIuHTAFILmUtFL@P8fAA \$\endgroup\$ Commented Feb 23, 2021 at 21:49
  • 1
    \$\begingroup\$ @Leo You should have used 0514150 commas for a nice symmetry! \$\endgroup\$ Commented Feb 23, 2021 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\$ Commented Feb 23, 2021 at 23:40
  • \$\begingroup\$ As per specification you may not use commas (,). \$\endgroup\$ Commented Sep 6, 2023 at 16:00
  • \$\begingroup\$ @KaiBurghardt I think that's just the way the list of excluded digits is formatted. But you can replace the commas with spaces or s to get an alternative program if you so wish. \$\endgroup\$ Commented Sep 6, 2023 at 17:21
9
\$\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++)&'#';);}

answered Feb 24, 2021 at 2:58
\$\endgroup\$
7
  • \$\begingroup\$ i as a global defaults to 0 saving a couple characters. Just change your main call to f in your example/ \$\endgroup\$ Commented Feb 24, 2021 at 20:58
  • \$\begingroup\$ Actually took I it further and made it recursive for a 2 more characters saved: \$\endgroup\$ Commented Feb 24, 2021 at 21:10
  • \$\begingroup\$ where did you learn this level of programming i don't even understand it \$\endgroup\$ Commented Feb 25, 2021 at 7:59
  • 2
    \$\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\$ Commented Feb 25, 2021 at 8:08
  • \$\begingroup\$ Capital C would also work - 64+3 = 'C' :) \$\endgroup\$ Commented Feb 25, 2021 at 19:21
9
\$\begingroup\$

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.

answered Feb 23, 2021 at 16:51
\$\endgroup\$
1
  • \$\begingroup\$ Also, jot $[##d] \$\endgroup\$ Commented Aug 3 at 10:00
8
\$\begingroup\$

Bash, (削除) 25 (削除ここまで) 23 bytes

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

Try it online!

-2 thanks to @manatwork

answered Feb 23, 2021 at 16:14
\$\endgroup\$
5
  • 8
    \$\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\$ Commented Feb 23, 2021 at 16:23
  • 2
    \$\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\$ Commented Feb 23, 2021 at 16:25
  • \$\begingroup\$ @manatwork thanks! \$\endgroup\$ Commented Feb 23, 2021 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\$ Commented Feb 23, 2021 at 16:35
  • 2
    \$\begingroup\$ @Jonah found it few days ago here, Actually I don't know a lot of documentation on bash \$\endgroup\$ Commented Feb 23, 2021 at 16:44
8
\$\begingroup\$

PowerShell, (削除) 16 (削除ここまで) 12 bytes

-4 bytes thanks to @mazzy!

0..(0xa*0xa)

Try it online!

answered Feb 23, 2021 at 16:43
\$\endgroup\$
4
  • 1
    \$\begingroup\$ Try it online! \$\endgroup\$ Commented Feb 23, 2021 at 22:12
  • \$\begingroup\$ @mazzy thanks! I feel silly for having missed that, lol \$\endgroup\$ Commented Feb 24, 2021 at 16:36
  • 1
    \$\begingroup\$ You beat me to it! \$\endgroup\$ Commented Feb 25, 2021 at 15:34
  • \$\begingroup\$ Why not just enter 0..100 \$\endgroup\$ Commented Nov 1, 2023 at 6:00
8
\$\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!

answered Feb 24, 2021 at 6:04
\$\endgroup\$
6
  • 2
    \$\begingroup\$ Welcome to Code Golf! Nice first answer. (Don't worry, you posted it correctly :p) \$\endgroup\$ Commented Feb 24, 2021 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\$ Commented Feb 24, 2021 at 6:08
  • 1
    \$\begingroup\$ Nice! The space before quotes can go, too :) \$\endgroup\$ Commented Feb 25, 2021 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\$ Commented Feb 25, 2021 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\$ Commented Feb 25, 2021 at 17:22
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.

answered Mar 2, 2021 at 8:18
\$\endgroup\$
1
  • 2
    \$\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\$ Commented Mar 2, 2021 at 8:35
8
\$\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!

answered Feb 23, 2021 at 19:28
\$\endgroup\$
2
  • \$\begingroup\$ Similar idea, same score \$\endgroup\$ Commented Feb 23, 2021 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\$ Commented Feb 23, 2021 at 20:54
7
\$\begingroup\$

Ruby (削除) 22 bytes (削除ここまで) 12 bytes - thanks to @manatwork

p *0..?d.ord

Try it online!

answered Feb 23, 2021 at 15:54
\$\endgroup\$
2
  • 1
    \$\begingroup\$ A splat * operator will do it instead of .to_a: p *0..?d.ord \$\endgroup\$ Commented Feb 23, 2021 at 16:00
  • 2
    \$\begingroup\$ You can switch to Ruby 1.8 and remove the .ord \$\endgroup\$ Commented Feb 23, 2021 at 20:02
7
\$\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.

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

Perl, (削除) 20 (削除ここまで), (削除) 13 (削除ここまで), (削除) 12 (削除ここまで), 16 bytes

say for 0..ord d 

Try it online!

answered Feb 23, 2021 at 16:01
\$\endgroup\$
7
  • \$\begingroup\$ You can get rid of ,ドル=",";, but you need ord('d') for it to work. \$\endgroup\$ Commented Feb 23, 2021 at 16:03
  • 1
    \$\begingroup\$ @PaulPicard: unquoted dee works here (perl v5.32.0), e.g. perl -E 'say 0..ord(d)' \$\endgroup\$ Commented Feb 23, 2021 at 16:08
  • 2
    \$\begingroup\$ You can remove the parenthesis. \$\endgroup\$ Commented Feb 23, 2021 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\$ Commented Feb 24, 2021 at 0:01
  • \$\begingroup\$ @Xcali: indeed, thanks \$\endgroup\$ Commented Feb 24, 2021 at 5:18
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.

answered Feb 23, 2021 at 17:49
\$\endgroup\$
1
  • \$\begingroup\$ Coreutils solution for 14B: jot - 0 $[##d] \$\endgroup\$ Commented Nov 10, 2021 at 1:55
7
\$\begingroup\$

Bash, (削除) 18 (削除ここまで) (削除) 16 (削除ここまで) 14 bytes

seq 0 $[++x]00

Try it online!

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

answered Feb 27, 2021 at 2:30
\$\endgroup\$
3
  • \$\begingroup\$ You don't need the braces. \$\endgroup\$ Commented Feb 27, 2021 at 2:53
  • \$\begingroup\$ Welcome to Code Golf! Nice first answer. \$\endgroup\$ Commented Feb 27, 2021 at 4:14
  • \$\begingroup\$ seq 0 $[++x]00 for 14. \$\endgroup\$ Commented Feb 28, 2021 at 3:43
7
\$\begingroup\$

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!

Explained

 # 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
answered Aug 2, 2021 at 12:18
\$\endgroup\$
7
\$\begingroup\$

Bash, 15

seq `dc<<<A0Kf`

Try it online!

  • 1 byte saved, thanks to @manatwork.

Previous answer:

Pure Bash (no external utilities), 23

  • 9 bytes saved thanks to @ArcticKona.
eval echo {0..$[++x]00}

Try it online!

answered Feb 23, 2021 at 15:52
\$\endgroup\$
7
  • \$\begingroup\$ Your newest solution skips "0" because you missed a space between seq's parameters. Sorry, that looks like +1 character. ☹ \$\endgroup\$ Commented Feb 23, 2021 at 20:28
  • \$\begingroup\$ @manatwork oops - yes, thanks - fixed. \$\endgroup\$ Commented Feb 23, 2021 at 20:30
  • 1
    \$\begingroup\$ As apology, here is a 15 character one, still based on your idea: seq `dc<<<A0Kf`. \$\endgroup\$ Commented Feb 23, 2021 at 20:31
  • \$\begingroup\$ @manatwork - thanks! \$\endgroup\$ Commented Feb 23, 2021 at 20:43
  • 1
    \$\begingroup\$ for pure bash try eval echo {0..$[++x]00} \$\endgroup\$ Commented Oct 29, 2021 at 7:40
7
\$\begingroup\$

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):

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

answered Nov 3, 2021 at 3:21
\$\endgroup\$
1
  • 3
    \$\begingroup\$ Glad to see some PICO-8 on CGCC! It's such a fun little engine to tinker around with. \$\endgroup\$ Commented Nov 3, 2021 at 8:50
7
\$\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)
CreaZyp154
8438 silver badges13 bronze badges
answered Feb 23, 2021 at 15:49
\$\endgroup\$
3
  • \$\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\$ Commented Feb 27, 2021 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\$ Commented Feb 28, 2021 at 16:52
  • \$\begingroup\$ 40 forward \$\endgroup\$ Commented Mar 28, 2022 at 19:20
7
+25
\$\begingroup\$

Python, (削除) 25 (削除ここまで) 23 bytes

print(*range(ord('e')))

-2 by Steffan, remove first parameter (0) from call to range

answered Jul 7, 2022 at 19:23
\$\endgroup\$
3
  • 1
    \$\begingroup\$ The 0, is not needed \$\endgroup\$ Commented Jul 7, 2022 at 19:54
  • 1
    \$\begingroup\$ Thanks a lot! I'll use it. \$\endgroup\$ Commented Jul 8, 2022 at 1:41
  • \$\begingroup\$ 21 bytes Try it online! \$\endgroup\$ Commented Apr 7 at 2:37
6
\$\begingroup\$

GNU Octave, (削除) 14 (削除ここまで), 5 bytes

0:'d'

TIO by Giuseppe

answered Feb 23, 2021 at 16:04
\$\endgroup\$
3
  • 1
    \$\begingroup\$ I think just 0:'d' should work. \$\endgroup\$ Commented Feb 23, 2021 at 16:14
  • \$\begingroup\$ @Giuseppe: nice one \$\endgroup\$ Commented Feb 23, 2021 at 16:17
  • 2
    \$\begingroup\$ Also, Octave is on TIO if you want to add a link :-) \$\endgroup\$ Commented Feb 23, 2021 at 16:19
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)
answered Feb 23, 2021 at 16:07
\$\endgroup\$
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.

answered Feb 24, 2021 at 3:14
\$\endgroup\$
4
  • \$\begingroup\$ Damn it. Rewriting. \$\endgroup\$ Commented Feb 24, 2021 at 3:30
  • \$\begingroup\$ @Razetime Remebered w doesn't care about accumulator. \$\endgroup\$ Commented Feb 24, 2021 at 3:32
  • \$\begingroup\$ "Hello, World!" is not a valid separator. \$\endgroup\$ Commented Feb 24, 2021 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\$ Commented Mar 7, 2021 at 16:30
1
2 3 4 5 6

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.