Looping counter
Looping counter
Create an infinite loop that outputs lines of asterisks, with each line containing one more asterisk. Instead of the asterisk, any printable, non-whitespace character can be used. However all lines need to use the same character.
The beginning of the output looks like this:
*
**
***
****
*****
******
*******
********
*********
**********
***********
************
An ungolfed Python implementation:
from itertools import count
for i in count(1):
print('*'*i)
Lua, 31 bytes ``` =''::::=.. …
2y ago
Vyxal, 5 4 bytes ``` ¤{‹… …
2y ago
[Ruby], 18 bytes lo …
2y ago
MATL, 16 bytes ``` 1`1yh1$ …
2y ago
Haskell, 35 bytes main=mapM …
2y ago
[brainfuck], 31 bytes + …
2y ago
[K (oK)], 9 bytes {x#0} …
3mo ago
C, 30 + 1-4 byte f(m){f …
1y ago
Fig, 5 bytes The actual score …
2y ago
Japt, 6 bytes ßOpP±Q …
2y ago
JavaScript, 25 bytes Could …
2y ago
J, 13 char ``` '',^:(<)'' ` …
2y ago
[C (gcc)], 47 bytes …
2y ago
[JavaScript (Node.js)], 31 byt …
2y ago
Embed ESCR, about 32 character …
2y ago
[><>], 10 bytes 1:naoa1 …
2y ago
[dc], 13 bytes [r1+pArd …
2y ago
[Bash], 17 bytes ec …
2y ago
[Python 2], 26 bytes …
2y ago
[Python 3], 28 bytes …
2y ago
[AWK], 26 24 bytes END{ …
5mo ago
21 answers
J, 13 char
'*',^:(<_)'*'
How it works: What's in parenthesis indicates to the verb ^: that the verb to the left of ^: has to be performed to the object on the right of the ^: an infinite number of times and that it has to list each intermediate result. '_' is infinity, and '<' boxes it to force listing the intermediate results.
'*',^:(<4)'*'
*
**
***
****
0 comment threads
- ← Previous
- 1
- 2
- Next →
2 comment threads