| Bytes | Lang | Time | Link |
|---|---|---|---|
| 011 | Uiua | 240810T090842Z | Joonas |
| 037 | Setanta | 240810T045950Z | bb94 |
| 035 | JavaScript Node.js | 240808T215518Z | Andrew B |
| 023 | YASEPL | 240209T231320Z | madeforl |
| 009 | Uiua SBCS | 240208T122616Z | chunes |
| 021 | Labyrinth | 240208T095218Z | Bubbler |
| 094 | TypeScript’s type system | 240117T212229Z | noodle p |
| 015 | Uiua | 240117T171948Z | Joao-3 |
| 003 | Vyxal 3 | 240114T191936Z | pacman25 |
| 050 | JavaScript | 230201T171039Z | EzioMerc |
| 057 | F# .NET Core | 230201T024415Z | dtanku |
| nan | 230201T150829Z | The Thon | |
| 006 | Pyt | 230201T000848Z | Kip the |
| 028 | ><> | 221201T142913Z | Emigna |
| 009 | GolfScript | 221130T234753Z | emirps |
| 021 | Knight v2.0alpha | 220918T064957Z | Sampersa |
| nan | Fig | 220908T185000Z | Seggan |
| nan | Fig | 220908T135056Z | lyxal |
| 054 | Deadfish~ | 220908T235934Z | naffetS |
| 022 | Julia | 220909T150604Z | amelies |
| 2421 | Julia | 220908T182628Z | Czylabso |
| 041 | yup | 220909T081817Z | Kevin Cr |
| 048 | Nibbles | 220909T080900Z | Dominic |
| 031 | Headass | 220908T202239Z | thejonym |
| 043 | Prolog SWI | 220909T000133Z | naffetS |
| 015 | Regenerate a | 220908T201247Z | DLosc |
| 015 | Regenerate | 220908T170818Z | DLosc |
| 005 | Husk | 220908T133358Z | Calga |
| 021 | Desmos | 220309T001530Z | Aiden Ch |
| 175 | Malbolge | 220308T233557Z | apollyon |
| 024 | Excel | 211214T172040Z | Engineer |
| 027 | Pure Zsh | 220101T071510Z | pxeger |
| 021 | Haskell | 200317T175410Z | xnor |
| 013 | Add++ i | 220101T051823Z | lyxal |
| 005 | Pip | 211231T235307Z | DLosc |
| 021 | APOL | 211221T201622Z | Ginger |
| 017 | Wolfram Language Mathematica | 200317T104500Z | ZaMoC |
| 037 | Lua | 211219T031048Z | Visckmar |
| 017 | TIBasic | 211218T190350Z | Youserna |
| 046 | A0A0 | 210612T130812Z | stefvans |
| 003 | Vyxal j | 210612T113813Z | emanresu |
| 029 | Factor | 210612T114949Z | chunes |
| 050 | JavaScript | 210224T095918Z | user1006 |
| 194 | Deadfish~ | 210224T091911Z | emanresu |
| 3237 | AWK | 210104T155500Z | Pedro Ma |
| 026 | Scala | 210103T203208Z | Michael |
| 006 | Canvas | 210103T063100Z | hakr14 |
| 019 | jq nr | 200317T100506Z | manatwor |
| 007 | mlochbaum/BQN | 201010T093058Z | Razetime |
| 056 | Rust | 201008T191756Z | ouflak |
| 007 | Husk | 201009T053948Z | Razetime |
| 222 | Poetic | 201009T012008Z | JosiahRy |
| 050 | brainfuck | 201009T005937Z | Daniel C |
| 059 | Java 11 JDK | 200317T143352Z | greinet |
| 1816 | x8616 machine code | 200624T135230Z | 640KB |
| 034 | Python 3 | 200625T131523Z | user9594 |
| 451 | Brainetry | 200624T151949Z | RGS |
| 021 | International Phonetic Esoteric Language | 200623T171436Z | bigyihsu |
| 032 | Clojure | 200622T180800Z | NikoNyrh |
| 020 | MAWP 0.1 | 200622T092504Z | Dion |
| 045 | C# Visual C# Interactive Compiler | 200622T100225Z | Jirka Pi |
| 075 | COW | 200526T151247Z | Domenico |
| 006 | cQuents | 200526T094640Z | PkmnQ |
| 047 | C gcc | 200422T083840Z | l4m2 |
| 028 | Fortran GFortran | 200322T125016Z | Dingus |
| 050 | Common Lisp | 200506T081853Z | Elcan |
| 038 | Python 3 | 200403T203725Z | Dion |
| 046 | C gcc | 200317T164223Z | dingledo |
| 005 | MathGolf | 200319T085826Z | Kevin Cr |
| 037 | Pure Bash | 200317T072930Z | Mitchell |
| 022 | dc | 200422T062355Z | Mitchell |
| 126 | vJASS | 200417T014829Z | ネルマン |
| 065 | C++ gcc | 200418T021152Z | Stealing |
| 048 | Javascript | 200417T232812Z | Matthew |
| 058 | [VBA] | 200403T215231Z | Marx |
| 008 | Gol><> | 200328T164519Z | Gegell |
| 018 | J | 200317T081213Z | Galen Iv |
| 109 | Whitespace | 200319T154943Z | Kevin Cr |
| 085 | Batch | 200321T052133Z | T3RR0R |
| 025 | Bash + Core utilities | 200317T074740Z | Mitchell |
| 004 | Japt P | 200317T125631Z | Shaggy |
| 039 | Factor | 200318T075503Z | Galen Iv |
| 047 | SNOBOL4 CSNOBOL4 | 200318T131052Z | Giuseppe |
| 004 | APL Dyalog Unicode | 200318T052418Z | AviFS |
| 005 | Stax | 200318T101914Z | Kevin Cr |
| nan | PHP | 200317T111742Z | Guillerm |
| 056 | IBM/Lotus Notes Formula Language | 200318T091914Z | ElPedro |
| nan | This is my dumbest code golf submission ever | 200318T091120Z | tia |
| 030 | Red | 200318T071137Z | Galen Iv |
| 030 | Zsh | 200318T061939Z | GammaFun |
| 082 | BrainFlak | 200317T165730Z | Wheat Wi |
| 025 | Ruby | 200317T231007Z | Level Ri |
| 036 | naz | 200318T005237Z | sporebal |
| 015 | R | 200317T233725Z | Giuseppe |
| 074 | Batch | 200317T203545Z | Neil |
| 004 | Japt | 200317T184257Z | Gymhgy |
| 029 | Haskell | 200317T135340Z | ovs |
| 032 | Python 2 | 200317T135024Z | ElPedro |
| 050 | C gcc | 200317T131741Z | S.S. Ann |
| 049 | Erlang escript | 200317T130129Z | user9206 |
| 035 | Google Sheets | 200317T123417Z | Engineer |
| 033 | JavaScript ES8 | 200317T081524Z | Arnauld |
| 003 | W | 200317T112518Z | user9206 |
| 013 | Perl 6 | 200317T115721Z | Jo King |
| 023 | Bubblegum | 200317T105815Z | ovs |
| 012 | Retina | 200317T105527Z | Neil |
| 053 | C gcc | 200317T105509Z | Noodle9 |
| 005 | Charcoal | 200317T104845Z | Neil |
| 034 | Python 3.8 | 200317T104119Z | Gáb |
| 005 | Jelly | 200317T095641Z | Nick Ken |
| 038 | Io | 200317T094728Z | user9206 |
| 056 | brainfuck | 200317T091140Z | Dorian |
| 069 | TSQL | 200317T084720Z | t-clause |
| 003 | 05AB1E | 200317T085818Z | Dorian |
| 018 | Perl 5 | 200317T084150Z | andytech |
| 018 | R | 200317T081844Z | Robin Ry |
| 030 | Kotlin | 200317T075149Z | snail_ |
| 027 | Icon | 200317T074712Z | Galen Iv |
| 015 | PowerShell | 200317T073312Z | mazzy |
| 008 | Keg | 200317T071207Z | lyxal |
| 028 | Python 2 | 200317T072402Z | Chas Bro |
| 006 | APL dzaima/APL | 200317T072132Z | Adá |
| 007 | APL Dyalog Unicode | 200317T072035Z | Bubbler |
Uiua, 11 bytes, 6 characters
▽.+1⇡9
Output: [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9]
YASEPL, 24 23 bytes
=a$`1=b)""+a;b,a<!+}4,9
explanation (in pseudocode)
=a$`1=b)""+a;b,a<!+}4,9 packed
=a$ a = 1
`1 !+}4,9 for(i = 0; i < 9; i++)
=b)""+a;b,a< print(str(a).repeat(a))
Labyrinth, 21 bytes
" }*!@
9 : {
:(1""
""
Intro
9 Push 9
Loop 1
:("" Duplicate and decrement; exit when top is 0
[9 8 7 6 5 4 3 2 1 0]
Loop 2
1:} Use the 0 as the basis for repunit;
append 1, copy to aux.stack [... i "1"*i | "1"*i]
*! Multiply i and "1"*i and print; exit when the stack is empty
{ Pull the repunit back [... i+1 "1"*i]
@ Halt
Labyrinth, 21 bytes
1:#
: (*
; !
%9_:@
"
Loop: [... "1"*i] -> [... "1"*i "1"*(i+1)]
1 Append 1 (multiply by 10 and add 1)
: Dup
#( Stack size - 1 (== i+1)
*! Multiply and print
:_9% Test if the current repunit % 9 is 0 and exit loop if so
;: Discard the test value and dup to increase the stack size by 1
9_:@ Halt
TypeScript’s type system, 94 bytes
type F<N extends 1[]=[1],L=N["length"]>=L extends 10?[]:[...{[_ in keyof N]:L},...F<[...N,1]>]
JavaScript, 50 bytes
_=>'122333444455555666666777777788888888999999999' // 50
_=>eval("for(s='',i=0;i<11;s+=''.padEnd(++i,i))s") // 50
n=>eval("for(s='';(n=-~n)<11;s+=''.padEnd(n,n))s") // 50
_=>'123456789'.replace(/(\d)/g,(d,i)=>d.repeat(i)) // 50
Try it:
f1=_=>'122333444455555666666777777788888888999999999' // 50
f2=_=>eval("for(s='',i=0;i<10;s+=''.padEnd(++i,i))s") // 50
f3=n=>eval("for(s='';(n=-~n)<11;s+=''.padEnd(n,n))s") // 50
f4=_=>'123456789'.replace(/(\d)/g,(d,i)=>d.repeat(i)) // 50
console.log(f1());
console.log(f2());
console.log(f3());
console.log(f4());
F# (.NET Core), 59 58 57 bytes (thanks ouflak!)
for i=1 to 9 do String.replicate i (string i)|>printf"%s"
or
for i=1 to 9 do printf"%s"(String.replicate i (string i))
Thunno N, \$ 8 \log_{256}(96) \approx \$ 6.58 bytes
9R1+eDJ*
Explanation
9R # Push range(0, 9)
1+ # Add one to each
e # To each number:
D # Duplicate
J # Cast to string
* # Repeat that many times
# N flag joins by newlines
# Implicit output
Pyt, 6 bytes
ɳąĐƖ*ǰ
ɳ pushes string containing all digits ("0123456789")
ą converts to ąrray of characters
Đ Đuplicates on stack
Ɩ casts top of stack to array of Ɩntegers
* string multiplication
ǰ ǰoin with no delimiter; implicit print
GolfScript, 9 bytes
10,{.`*}/
Explanation
/ # for each element in...
10,{ # 0-9
. # duplicate it
` # stringify it
* # push to the stack the stringified version of the number, repeated that many times
} # end block
# implicitly output the stack
Fig, \$6\log_{256}(96)\approx\$ 4.939 bytes
Mcd'*_
Lyxal tried to outgolf me in my own language again.
Mcd'*_ # Full program
cd # Digits
M ' # Map each digit string
* # Repeat the digit
_ # By the number form of it
Fig, \$7\log_{256}(96)\approx\$ 5.762 bytes
Ma9'*+D
Explained
Ma9'*+D
Ma9' # To each item n in the range [1, 9]
*+D # Repeat the stringified n, n times
Deadfish~, 61 54 bytes
ioiooioooiooooioooooiooooooioooooooiooooooooiooooooooo
-7 bytes thanks to Bubbler.
Separating by zeros:
Deadfish~, 128 bytes
{iiiii}dcdciiccddciiicccdddciiiiccccddddciiiiicccccdddddciiiiiiccccccddddddc{i}dddccccccc{d}iiic{i}ddcccccccc{d}iic{i}dccccccccc
By spaces:
Deadfish~, 159 bytes
{iiiii}dc{dd}iiic{ii}ddcc{dd}iic{ii}dccc{dd}ic{ii}cccc{dd}c{ii}iccccc{dd}dc{ii}iicccccc{dd}ddc{ii}iiiccccccc{dd}dddc{ii}iiiicccccccc{dd}ddddc{ii}iiiiiccccccccc
Julia, 22 bytes
1:9 .|>i->show("$i"^i)
prints
"1""22""333""4444""55555""666666""7777777""88888888""999999999"
Relying on the repl for printing output we can get to 17 bytes
~i="$i"^i;.~(1:9)
Julia, 24/21 bytes
w/o
(a=1:9).*(10 .^a.-1).÷9
and w/ macro:
a=1:9;@.a*(10^a-1)÷9
- array of numbers, nothing new
yup, 43 41 bytes
0e:{~:{~:#~0e-}0e--:0ee00e--|00e--e0e-~-}
Explanation:
0e # Push 1 (push 0; pop and push exp(0))
: # Duplicate it
{ # Loop while the top of the stack is >0 (without popping):
~ # Swap the top two values on the stack
: # Duplicate the top
{ # Inner loop while the top of the stack is >0 (without popping):
~ # Swap the top two values on the stack
: # Duplicate the top
# # Pop and print it as number
~ # Swap the top two values on the stack back
0e- # Decrease it by 1 (push 0; pop and push exp(0); subtract)
} # Stop the inner loop if the top of the stack is <=0 (without popping)
0e-- # Increase the current value by 1 (using the 0 that was still on the
# stack as: push 0 → exp(0)=1 → 0-1=-1 → --1=+1)
: # Duplicate the top again
0ee00e--|00e--e0e-
# Push 9.107... (see below)
~ # Swap the top two values again
- # Subtract the current value from the 9.107...
} # Stop the outer loop if the top of the stack is <=0 (without popping)
# (which it will be once we've reached 10)
0ee00e--|00e--e0e- # Push 9.107...:
0 # Push 0 - STACK: 0
e # exp(0) - STACK: 1
e # exp(1) - STACK: 2.718...
0 # Push 0 - STACK: 2.718...,0
0 # Push 0 - STACK: 2.718...,0,0
e # exp(0) - STACK: 2.718...,0,1
- # Subtract - STACK: 2.718...,-1
- # Subtract - STACK: 3.718...
| # ln(3.718...) - STACK: 1.313...
0 # Push 0 - STACK: 1.313...,0
0 # Push 0 - STACK: 1.313...,0,0
e # exp(0) - STACK: 1.313...,0,1
- # Subtract - STACK: 1.313...,-1
- # Subtract - STACK: 2.313...
e # exp(2.313...) - STACK: 10.107...
0 # Push 0 - STACK: 10.107...,0
e # exp(0) - STACK: 10.107...,1
- # Subtract - STACK: 9.107...
Nibbles, 4 bytes (8 nibbles)
,9^$`p
,9^$`p
# implicitly map over
,9 # integers from 1 to 9
^ # replicating
`p # the character of each
# by itself times
Headass, 31 bytes
+^{{D^(]<)PN][}:(+++[]]]>)N^-[}
Beats the naive solution (+P+PP+PPP... and so on for 54 bytes) by 23 bytes.
Outputs individual digits separated by newlines
Breakdown:
+^{{D^(]<)PN][}:(+++[]]]>)N^-[} full program
+^ initialize r1 to be 1
r2 is already initialized to 0
{ } repeat
D^( ) :( ) until r1
+++[]]]> fails to be less than 9
{ } repeat
D^( ) until r1
]< fails to be more than r2
D P print r1
N][ increment r2
end repeat
N^ increment r1
N -[ set r2 to 0
end repeat
Regenerate -a, 15 bytes
([1-9])$1{$1-1}
Outputs 1 through 999999999 on separate lines. Attempt This Online!
Explanation
The -a flag outputs all possible matches on separate lines.
([1-9])$1{$1-1}
[1-9] Pick a digit 1 thru 9
( ) Store it in group 1
$1 Match group 1 again
{ } this many times:
$1 Group 1 contents
-1 minus 1
Alternate -a solution, also 15 bytes:
([1-9])(){1,$1}
Outputs digits on separate lines. Attempt This Online!
([1-9])(){1,$1}
[1-9] Pick a digit 1 thru 9
( ) Store it in group 1
() Match empty string
{ } this many times:
1, Minimum of once
$1 Maximum of (group 1 contents) times
Regenerate, 15 bytes
(#1{#1} ! ){10}
Outputs space-separated runs of digits, with a leading and a trailing space. Attempt This Online!
Explanation
Spaces are replaced with underscores for clarity.
(#1{#1}_!_){10}
{10} Repeat 10 times
( ) and store as group 1 after each match:
#1 Length of previous match of group 1
{#1} repeated (length of previous match of group 1) times
_ followed by a space
! Or, if that failed because there was no previous match of group 1,
_ just a space
The first match of group 1 is a space, which has length 1, so the second match is one 1 followed by a space, which has length 2, so the third match is two 2's followed by a space, and so forth.
Desmos, 21 bytes
l=[1...9]
l10^l/9-l/9
Try It On Desmos! - Prettified
Uses the following formula for the \$n\$th number:
$$\frac{10^n-1}9\times n$$
[1,22,333,4444,55555,666666,7777777,88888888,999999999] is the value of the list in the second line.
Made it look "obfuscated" for fun but it's really just the same as:
l=[1...9]
l(10^l-1)/9
which is also 21 bytes.
Malbolge, 175 bytes
(C%;_#"~[}43WVxwuRt+*NMLmlljGig}CBAc?=vNtLr[v64m321/RzP+Ncha&&Gc#EDBX|{zx=vv:bs6p^]nllk/iVgfdvD'`N#?\\6YY3WUwvvQtPOqLo,JIHGihfCddcx>=<;:9[Y6XVl210/.-O+MLJ`&HG\[!~}|{z>=wv998rp
Excel, 29 24 bytes
Saved 5 bytes thanks to Taylor Raine
=REPT(ROW(1:9),ROW(1:9))
ROW(1:9) returns an array of the numbers 1 through 9 so the REPT() function repeats each of those numbers itself-many times.
Haskell, 21 bytes
[c<$[1..c]|c<-[1..9]]
A list of lists of numbers.
23 bytes
replicate<*>id=<<[1..9]
A flat list of numbers.
Add++ -i, 14 13 bytes
L,9Rdz£XbUBvn
This is making me cry. A fun feature of like 99% of stack commands is that it applies to the whole stack rather than the top of the stack. Very very helpful.
-1 thanks to caird which kinda makes up for the suffering of this
Explained
L,9Rdz£XbUBvn
L, # Start a lambda which is called implicitly by the -i flag
9R # Push the range [1...9]
dz # and zip it with itself, giving [[1, 1], [2, 2] ... [9, 9]]
£X # repeat x[0] by x[1] times for each x in that
bU # dump the contents of that onto the stack. This is a very important part because as I said, 99% of lambda stack commands map over to the whole stack, even when using quicks and stuff.
Bv # join each item (on the stack...) into a single integer
n # and join (the stack...) on newlines
Pip, 5 bytes
,tX,t
Explanation
,t Range(10)
X String-repeat (itemwise)
,t Range(10)
That is, for each number in [0; 1; 2; 3; 4; 5; 6; 7; 8; 9], repeat it a number of times equal to itself. The result is the list [""; 1; 22; 333; 4444; 55555; 666666; 7777777; 88888888; 999999999], which is by default concatenated together and printed.
APOL, 21 bytes
ⅎ(9 p(*(t(∈) ∈)))
TI-Basic, 17 bytes
seq(I(₁₀^(I)-1)/9,I,1,9
Output is stored in Ans as a list and displayed.
A0A0, 46 bytes
O122333444455555666666777777788888888999999999
Literally prints the example output. I'd be very surprised if you can get something smaller in A0A0. The first O outputs the number following it and the number following it is the output. The language specification does not state any restriction on the size of the number, just "signed integer", so this works. (Although an interpreter may not handle this correctly, because this is a 147 bit number and not every language may support numbers that large.)
JavaScript, 50 bytes
_=>{for(i=0;++i<10;)console.log((''+i).repeat(i))}
Deadfish~, 194 bytes
{{i}ddddd}dc{d}{d}iiic{i}{i}ddcc{d}{d}iic{i}{i}dccc{d}{d}ic{i}{i}cccc{d}{d}c{i}{i}iccccc{d}{d}dc{i}{i}iicccccc{d}{d}ddc{i}{i}iiiccccccc{d}{d}dddc{i}{i}iiiicccccccc{d}{d}ddddc{i}{i}iiiiiccccccccc
AWK, 32 or 37 bytes
This code needs an EOF at the prompt, or a file with an empty line.
{for(;++i<10;)print(10^i-1)/9*i}
To substitute the input, one can use the BEGIN pattern, adding 5 more bytes to the code.
BEGIN{for(;++i<10;)print(10^i-1)/9*i}
jq (-nr), 20 19 characters
range(9)+1|"\(.)"*.
Thanks to:
- 2x-1 for pointing out that
range()does not produce array, so operators will see separate numbers.
Sample run:
bash-5.0$ jq -nr 'range(9)+1|"\(.)"*.'
1
22
333
4444
55555
666666
7777777
88888888
999999999
mlochbaum/BQN, 7 bytes
⥊˜¨1+↕9
Explanation
⥊˜¨1+↕9
↕9 range from 0 to 8
1+ add 1 to each
¨ for each element n,
⥊˜ replicate n times
Rust, 77 75 73 72 57 56 bytes
fn main(){for k in 1..10{for j in 0..k{print!("{}",k)}}}
And I thought Lua was verbose!
Thanks to ovs for saving 15 bytes.
Poetic, 222 bytes
THE NUMERICAL I/O RULES
i saw a digit,o yes
o,again,i saw a number;too many
i do the I/O rules,i get a repeat
i now count to zeros
o,from one right to nine,i do digits,e.t.c
seldom a newline,since i know i am swayed not to
brainfuck, 50 bytes
+[>+<+++++]+++++++++[>-->+[<.>>+<-]>[<+>-]<<+++<-]
Assumes byte cells; does not go out of bounds to left.
Java 11 (JDK), 60 59 bytes
Not sure if thats the shortest approach but couldn`t make it shorter even without System.out.print. Output is without delimiters.
-1 byte thanks to Kevin Cruijssen
v->{for(int i=0;i++<9;System.out.print((i+"").repeat(i)));}
x86-16 machine code, IBM PC DOS, 18 16 bytes
Binary:
00000000: b839 0ab2 09b1 2dcd 1048 2aca 4a75 f8c3 .9....-..H*.Ju..
Listing:
B8 0A39 MOV AX, 0A39H ; AH = 0AH, AL = '9'
B2 0A MOV DL, 10 ; DL as counter value
B1 2D MOV CL, 1+2+3+4+5+6+7+8+9 ; start digit repeat 45 times
NLOOP:
CD 10 INT 10H ; call BIOS - write digit * CX times
48 DEC AX ; decrement ASCII digit
4A DEC DX ; decrement counter value
2A CA SUB CL, DL ; reduce digit repeat value by counter
75 F8 JNZ NLOOP ; loop until 0
C3 RET ; return to DOS
Explanation:
This uses the PC BIOS API's INT 10H / 0AH function to write the ASCII char in AL to the screen CX number of times. However, this function does not update the cursor position to the end of the output -- it just stays where it started. In other words, the next call simply overstrikes existing characters writing over them. Making a BIOS call to advance the cursor is expensive byte-wise.
Since going forward isn't going to work, we go backwards starting from '9'. It writes '9' 45 times, then '8' 36 times, '7' 28 times, etc -- each time starting from the first column overwriting like so:
999999999999999999999999999999999999999999999
888888888888888888888888888888888888999999999
777777777777777777777777777788888888999999999
666666666666666666666777777788888888999999999
555555555555555666666777777788888888999999999
444444444455555666666777777788888888999999999
333333444455555666666777777788888888999999999
222333444455555666666777777788888888999999999
122333444455555666666777777788888888999999999
Output:
Brainetry, 451 bytes
This is the golfed version, ungolfed version below.
a b c d
a b c d e f g h
a b c d e f g h
a b c
a b c d
a b
a b c d e
a b
a b c d
a b c d
a b c d
a b c d
a b c d
a b c
a b c d e f g h i
a b
a b c d
a b c d e f g h i
a b c
a b c
a b c d e
a b c d e
a b c
a b c d e
a b c d e f g h
a b
a b
a b c d
a b c d e f g h
a b c
a b c d e f g
a b
a b c d e
a b
a b c d
a b c
a b c d e f g h i
a b
a b c d e f g h
a b c
a b c d
a b
a b c d e
a b c d e f g h i
a b c
a b c
a b c d
a b c
a b c d e
a b c d e f g h i
To try this online, follow this link and paste the code in the btry/replit.btry file, then hit the green "Run" button.
Golfed version of the program below:
Let me explain what
is going on with this brainetry program: this
program will print the digits one to nine
and each of
those is going to
be repeated
as many times as its
own value.
Makes sense, doesn't it?
To achieve such result
we have to play
around with some nice
values in our tape.
That, and we
also have to play smart with our program pointer.
Of course
I would be delighted
to actually explain the algorithm used by this program.
The only problem
is I really
have no idea whatsoever about
what is actually going on.
Let me explain:
brainetry's instructions are a superset
of brainfuck, which means any brainfuck program can
be translated
to brainetry
and it will work.
So this is what I did, I found
a brainfuck program
that completed this task I described and
I just
translated it from brainfuck to
brainetry. Probably
there are simpler approaches
if we take
into consideration the extended operations that brainetry provides ...
However, brainetry
is still in its early stages of development
and I am
still trying to figure
out exactly
what operations to add to
brainetry. Once that set of operations becomes more well-defined
it will be
easier to harness
brainetry's power to write
computer programs. And
once that is finally done,
I will not have to steal random brainfuck programs.
This brainetry answer built on top of this answer
International Phonetic Esoteric Language, 21 bytes
{A}1ɑee0ɑbue1søɒe1søɒ
Prints 122333444455555666666777777788888888999999999.
Explanation:
{A}1ɑee0ɑbue1søɒe1søɒ
{A}1 (push loop bounds, 1 to 10)
ɑ (start loop)
e (push the current index)
e0 (push loop bounds for current digit, 0 to index)
ɑ (start loop)
bu (DUP and CPRINT current digit)
e1sø (increment index)
ɒ (end loop)
e1sø (increment index)
ɒ (end loop)
Clojure, 32 bytes
(for[i(range 1 10)](repeat i i))
This results in a lists of numbers:
((1) (2 2) (3 3 3) (4 4 4 4) (5 5 5 5 5) (6 6 6 6 6 6) (7 7 7 7 7 7 7) (8 8 8 8 8 8 8 8) (9 9 9 9 9 9 9 9 9))
MAWP 0.1, 22 20 bytes
[![~!:~1A]%!9A?.%1M]
Explanation:
[ start of loop
! duplicates top of stack
[ start of loop
~!:~ prints bottom stack value
1A subtracts 1
] end of loop
% removes top of stack (0 from the counter in the previous loop)
!9A diffeence between top value and 9
?. if top 0, then terminate program
% removes top value
1M adds 1 to top value
] end of loop
C# (Visual C# Interactive Compiler), 45 bytes
for(int j,i=0;i++<9;)for(j=i;j-->0;Write(i));
COW, 75 bytes
MoOMoOMoOMoOMoOMoOMoOMoOMoOMOOmoOMoOMMMmoOMMMMOOmOoOOMmoOMOomoomOomOoMOomoo
Uncowed
moo ] mOo < MOo - oom o
MOO [ moO > MoO + MMM =
+++++++++[>+=>=[<o>-]<<-]
C (gcc), 47 bytes
k;main(i){for(;9>printf("%d",i*++k);i=i*10+1);}
C (gcc), 49 bytes
main(i){for(;9>printf("%lX",(i*1L<<4*i++)/15););}
Fortran (GFortran), 38 28 bytes
print*,(10**i/9*i,i=1,9)
end
Edit: Turns out the program statement is optional, saving 10 bytes!
Python 3, 38 bytes
print([str(x)*x for x in range(1,10)])
C++ (gcc), 59 bytes
for(int i=1;i<10;++i){for(int x=1;x<=i;++x){std::cout<<i;}}
Started learning c++ an hour ago, tried codegolf :)
MathGolf, 6 5 bytes
9{îÄí
-1 byte thanks to @maxb.
Explanation:
9{ # Loop 9 times:
î # Push the 1-based loop index
Ä # Do an inner loop that many times, using a single command:
í # Push the total number iterations of the outer loop
# (after the loops, the entire stack is joined together and output implicitly)
vJASS, 126 bytes
//! zinc
library q{function onInit(){integer x,y;string s="";for(1<=x<10){for(0<=y<x){s+=I2S(x);}}BJDebugMsg(s);}}
//! endzinc
C++ (gcc), 93, 65 bytes
int a;void n(){int b=a;while(b){std::cout<<a;b--;}if(a++!=9)n();}
The loop work is essentially the same as the previous version, but instead its own function.
It sets the starting digit -> 1 -> counter then it prints digits until the counter reaches 0. At that point it increments the digit and recalls the function until 9.
C++ (gcc), 93 bytes
int main(int n){static int a=1;int b=a;if(b>9)return 0;while(b){std::cout<<a;b--;}main(a++);}
Don't mind the main...
[VBA] 58 bytes
i=1:While i<0:For x=1 to i:Debug.Print i:Next x:i=i+1:wend
Can be ran in Immediate
Gol><>, 8 bytes
aFLRL|D;
aF | For Loop, from 0 to 10 excluding 10
L Push the current loop iteration to the stack
RL Pop the current iteration and repeat pushing the loopiterator value so many times
D; Print the entire stack content as numeric values with the debug operation and halt
Whitespace, 109 bytes
[S S S T S S T N
_Push_9][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_top][N
S S S N
_Create_Label_INNER_LOOP][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S T N
_If_0_Jump_to_Label_DONE_INNER_LOOP][S T S S T N
_Copy_0-based_1st][S N
T _Swap_top_two][N
S N
S N
_Jump_to_Label_INNER_LOOP][N
S S T N
_Create_Label_DONE_INNER_LOOP][S N
N
_Discard_top][S N
S _Duplicate_top][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S S S N
_If_0_Jump_to_Label_DONE_LOOP][N
S N
N
_Jump_to_Label_LOOP][N
S S S S N
_Create_Label_DONE_LOOP][S N
N
_Discard_top][N
S S S T N
_Create_Label_PRINT_LOOP][T N
S T _Print_top_as_integer][N
S N
S T N
_Jump_to_Label_PRINT_LOOP]
Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Try it online (with raw spaces, tabs and new-lines only).
Explanation in pseudo-code:
Push n=9
Start LOOP:
Duplicate top (Integer i = n)
Start INNER_LOOP
i = i - 1
if(i == 0):
Jump to DONE_INNER_LOOP
Copy n (0-based index 1)
Swap
Go to next iteration of INNER_LOOP
DONE_INNER_LOOP:
Discard i
n = n - 1
if(n == 0):
Jump to DONE_LOOP
Go to next iteration of LOOP
DONE_LOOP:
Discard n
Start PRINT_LOOP:
Print top as integer
Go to next iteration of PRINT_LOOP
Funny thing is, is that outputting with the additional single leading 0 as the challenge in the Sandbox initially had, this could have been 11 bytes shorter: try it online. xD
Batch, 85 Bytes
@for /L %%A in (1 1 9)do @For /L %%B in (1 1 %%A)do @Call Set O=%%O%%%%A
@Echo(%O%
TIO not available.
Bash + Core utilities, 27, 25 bytes
seq -f8d%f*7-v1+2/n 45|dc
Changed seq formatting from %0.f to %f for a 2-byte savings.
Modified to print on one line, with no delimiters, instead of having a newline after each number, just because I like that better. Same number of bytes.
This uses the formula $$\left\lfloor\frac{\big\lfloor\sqrt{8n-7}\big\rfloor+1}2\right\rfloor$$
for the \$n^{th}\$ digit, where \$n\$ goes from 1 to 45.
SNOBOL4 (CSNOBOL4), 47 bytes
O OUTPUT =DUPL(X,X)
X =LT(X,9) X + 1 :S(O)
END
Prints with a leading newline.
APL (Dyalog Unicode), 4 bytes
\⍨⍳9
How it works
⍳9 ⍝ Integers 1..9
⍨ ⍝ Duplicate argument on each side
\ ⍝ Replicate each element *n* times
Examples
Index Generator: ⍳5 = 1 2 3 4 5
Expand: 2 3 \ 1 4 = 1 1 4 4 4
Commute: +⍨4 = 4 + 4 = 8
Stax, 5 bytes
╜├ìíy
Try it online or try it online unpacked (6 bytes).
Explanation (of the unpacked version):
Vd # Push constant "0123456789"
A # Push 10
r # Pop and push a list in the range [0, 10)
:B # Repeat the characters in the string the integer amount of times:
# "122333444455555666666777777788888888999999999"
# (after which the top of the stack is output implicitly as result)
IBM/Lotus Notes Formula Language, 56 bytes
@For(x:=1;x<10;x:=x+1;@Set("o";o:@Repeat(@Text(x);x)));o
Formula in a multi value form field, once again showing that the only real use for @For in Notes is Code Golf!
This is my dumbest code golf submission ever, but here it goes
SQLite, 53 bytes
SELECT'122333444455555666666777777788888888999999999'
Red, 30 bytes
repeat a 9[repeat b a[prin a]]
Well, the most obvious way to do it is the shortest in Red.
Brain-Flak, 90 82 bytes
([(()()())({}){}]){((({})()<([{}]((((()()()){}){}){}){})>)<{({}()<(({}))>)}{}>)}{}
Explanation:
Compare this with the output of JoKing's autogolfer
Brain-Flak, 142 bytes
(((((((((((((((((((((((((((((((((((((((((((((((((()()()){}){}){}){}())()))())))()))))())))))()))))))())))))))()))))))))()))))))))){({}<>)<>}<>
Strange delimiters, 78 bytes
([(()()())({}){}]){((({})()<([{}]((((()()()){}){}){}){})>)<{({}()<(({}))>)}>)}
If we decide to play around with our delimiters a bit, we can shave off 4 bytes. This version outputs the correct stuff but with two leading null bytes and null bytes between the chunks:
This is a tiny bit cheaty but it meets the specs of the challenge.
And for posterity here is the old super cheaty version that has been made obsolete by my golfs.
Ruby, 30 25 bytes
1.upto(9){|i|p 10**i/9*i}
10**i/9 gives a number with i digits, all 1s. Multiply by i for the required output.
naz, 36 bytes
1a1o1a2o1a3o1a4o1a5o1a6o1a7o1a8o1a9o
Outputs all the numbers with no extra delimiter, using the same functionality described in this answer.
Batch, 74 bytes
@set s=
@for /l %%i in (1,1,9)do @call set s=%%s%%0&call echo %%s:0=%%i%%
Outputs on separate lines. Extends the string length by 1 and replaces the character with the current digit for each output.
The call commands are required so that the variable s is processed inside the loop instead of before parsing the loop.
Google Sheets, 35 bytes
=ArrayFormula(Rept(Row(1:9),Row(1:9
Sheets will automatically add three trailing parentheses when you exit the cell. Output is one line per row.
JavaScript (ES8), 33 bytes
f=n=>n>9?'':''.padEnd(n,n)+f(-~n)
Commented
f = n => // n = counter, initially undefined
n > 9 ? // if n is greater than 9:
'' // stop recursion
: // else:
''.padEnd(n, n) // pad an empty string with n digits n
// this leaves the empty string unchanged for n undefined
+ f(-~n) // add the result of a recursive call with n + 1
Building in reverse order (38 bytes)
A somewhat funny alternate method is to build the string from \$n=9\$ to \$n=1\$ and pad the recursive call instead of an empty string.
By doing it this way, the required padding length is:
$$L_n=\left\lfloor\frac{n^2}{2}+1\right\rfloor$$
f=(n=9)=>n?f(n-1).padEnd(n*n/2+1,n):''
W 5 4 3 bytes
@π┐
Uncompressed:
$*9N
Repeat 1..9 N times.
Explanation
M % Map in the range
9 % From 1 to 9
a$ % Stringify the current counter
a * % Repeat that string by the current counter
Perl 6, 13 bytes
{1..9 Zx^9+1}
Anonymous code block that returns a list of strings by zip string multiplying the range 1 to 9 with itself.
Bubblegum, 23 bytes
00000000: 3334 3232 3636 3601 0253 1030 0303 7308 3422666..S.0..s.
00000010: b080 024b 1800 00 ...K...
Retina, 12 bytes
9*
$.`*$.`
Try it online! Outputs a leading _ to each number, which appears to be acceptable (would cost 2 bytes to fix if not). Explanation:
9*
Insert 9 _s.
$.`*$.`
Around each _, insert its position repeated appropriately.
C (gcc), 54 53 bytes
i;j;f(){for(i=0;9/++i;)for(j=0;j++<i;)putchar(48+i);}
No delimiters between the numbers.
Charcoal, 5 bytes
⭆χ⭆ιι
Try it online! Link is to verbose version of code. Outputs without separators. The first StringMap could be changed into a for statement for the same byte count. Explanation:
χ Predefined variable 10
⭆ Map over implicit range and join
ι Current index
⭆ Map over implicit range and join
ι Outer index
Implicitly print
Jelly, 5 bytes
9ẋ`€Ḍ
A niladic link returning a list of integers. If a program printing the numbers is preferred, subsitute Y for Ḍ.
Explanation
9 | Literal 9
ẋ`€ | Repeat each that many times
Ḍ | Convert from decimal digits to integer
Io, 38 bytes
Range 1 to(9)map(i,i*(10**i-1)/9)print
Io, 47 bytes
Range 1 to(9)map(i,i asString repeated(i))print
brainfuck, 56 bytes
+++++++[>+++++++<-]+++++++++[<+[>>.<<-<+>]<[>+<-]>>>+<-]
+++++++[>+++++++<-] 49 (ASCII "1")
+++++++++[ do 9 times
<+ add 1 to output counter
[ do that many times
>>.<< print character
-<+> move value of output counter to temp
]
<[>+<-] move value of temp back to output counter
>>>+ increment character
<- decrement loop counter
]
05AB1E, 3 bytes
9L×
9L Build a list from 1 to 9 {1, 2, 3, 4, 5, 6, 7, 8, 9}
× copy each number that many times
APL (dzaima/APL), 6 bytes
Full program, requiring ⎕IO←0.
⍋⍛⌿⍨⎕D
⎕D on the string "0123456789",
⍛⌿⍨ replicate the characters by
⍋ their grade (0, 1, 2, …, 9)
APL (Dyalog Unicode), 7 bytesSBCS
⎕D/⍨⍳10
Uses ⎕IO←0.
How it works
⎕D/⍨⍳10
⎕D ⍝ The string '0123456789'
/⍨ ⍝ Replicate each of them the following times...
⍳10 ⍝ 0..9






