| Bytes | Lang | Time | Link |
|---|---|---|---|
| 015 | How dare you fuck the brain | 241003T190824Z | Gleb |
| 023 | PascalABC.NET | 241126T075417Z | Gleb |
| 010 | Raku Perl 6 rakudo | 250416T185403Z | xrs |
| 023 | Tcl | 170619T164924Z | sergiol |
| 041 | SAKO | 250320T081516Z | Acrimori |
| 016 | Alice | 240402T201540Z | Julian |
| 005 | Kona | 250116T145358Z | Abstract |
| 111 | Bespoke | 250115T193816Z | Josiah W |
| 052 | Hatchback | 250114T134527Z | madeforl |
| 006 | Kakoune | 241222T010452Z | JoshM |
| 013 | Python 3 | 240927T215245Z | The Empt |
| 012 | Casio BASIC fx9750giii | 240910T143653Z | madeforl |
| 018 | Python 3 | 240928T034159Z | a random |
| 021 | punchcode | 240927T172355Z | madeforl |
| 026 | +Output | 240621T014622Z | Evylah |
| 007 | Uiua | 240620T141901Z | Joonas |
| 020 | Brainfuck+2 | 240511T113548Z | None1 |
| 026 | TI84 BASIC | 240509T151456Z | madeforl |
| 009 | TECO | 240402T163623Z | LdBeth |
| nan | 240402T115929Z | RARE Kpo | |
| nan | 240401T043530Z | Hapisnak | |
| 018 | Swift | 240313T122946Z | macOSist |
| 055 | Pascal | 240312T165513Z | Kai Burg |
| 010 | YASEPL | 240208T004031Z | madeforl |
| 006 | Rattle | 240206T040506Z | d01 |
| 005 | Uiua SBCS | 240205T233950Z | chunes |
| 014 | Labyrinth | 240205T233151Z | Bubbler |
| nan | Piet + asciipiet | 220426T024139Z | Bubbler |
| 153 | Nibbles | 230116T231547Z | Dominic |
| 019 | Python 3 | 220313T115229Z | Joao-3 |
| 007 | shell commands | 230104T184542Z | gildux |
| nan | 221014T181206Z | bigyihsu | |
| nan | Fig | 221014T154054Z | Seggan |
| 003 | rig | 180308T212436Z | Yotam Sa |
| 003 | Pushy | 161117T185230Z | FlipTack |
| 004 | Juby | 170619T194820Z | Cyoce |
| 047 | Java | 160901T141453Z | Shaun Wi |
| 008 | Regenerate a | 220707T211015Z | naffetS |
| 022 | Flobnar | 220706T071846Z | Bubbler |
| 016 | Cognate | 220702T045542Z | DLosc |
| 020 | Ruby | 220426T060453Z | oeuf |
| 028 | Aussie++ | 220321T032354Z | Bbrk24 |
| 004 | Ly | 210427T033655Z | cnamejj |
| 018 | Swift 5.6 | 220317T230333Z | Bbrk24 |
| 040 | Piet | 220317T223304Z | Spectral |
| 014 | Julia 1.7 | 220217T035009Z | David Sc |
| 050 | Headascii | 220217T021022Z | thejonym |
| 067 | dotcomma | 201002T110558Z | Dorian |
| 067 | dotcomma | 210413T163346Z | rydwolf |
| 002 | Japt | 210715T100312Z | Shaggy |
| 016 | Knight | 210524T031434Z | EasyasPi |
| 015 | Factor | 210426T213121Z | chunes |
| 016 | Hexagony | 210426T193310Z | je je |
| 043 | CSASM v2.4.0.2 | 210426T161501Z | absolute |
| 009 | BRASCA | 210426T140159Z | SjoerdPe |
| 002 | Vyxal | 210426T134639Z | Aaroneou |
| 013 | Grok | 210413T165848Z | Aaroneou |
| 040 | BitCycle u | 201003T043146Z | DLosc |
| 032 | Rockstar | 201002T111545Z | Shaggy |
| 022 | 1+ | 200813T025311Z | Twilight |
| 013 | MAWP | 200812T065438Z | Razetime |
| 038 | Flurry | 200812T063651Z | Bubbler |
| 002 | W | 200131T033726Z | user8505 |
| 042 | Intcode | 191227T023543Z | The Fift |
| 128 | Commodore BASIC | 170126T161450Z | Shaun Be |
| 027 | Rogex | 200121T051022Z | lyxal |
| 050 | naz | 200120T205738Z | sporebal |
| 041 | BrainFuck | 200109T074458Z | Parsa Sh |
| 006 | GolfScript | 200109T060040Z | user8505 |
| 055 | Spice | 191227T154448Z | Slord6 |
| 004 | W z | 191227T040559Z | user8505 |
| 008 | Keg | 191227T041135Z | user8505 |
| 028 | Wren | 191206T142148Z | user8505 |
| 049 | Intcode | 191205T215421Z | lyxal |
| 018 | RUBY | 191118T074043Z | Almarks |
| 163 | Poetic | 191118T113044Z | JosiahRy |
| 054 | Hexadecimal Stacking PseudoAssembly Language | 191118T091827Z | Dorian |
| 034 | PHP with goto | 170622T104052Z | Shaun Be |
| 013 | Perl 5 | 190920T203007Z | rpGYNay0 |
| 002 | Putt | 190919T001928Z | ajmwagar |
| 199 | Turing Machine Language | 190918T140508Z | ouflak |
| 025 | MarioLANG | 190916T080527Z | Dorian |
| 012 | Clojure REPL | 190917T051003Z | Lucky |
| 005 | Keg | 190916T234219Z | user8505 |
| 015 | ROOP | 160723T042514Z | DarkPhan |
| 017 | Brian & Chuck | 190916T074118Z | Dorian |
| 045 | Javascript 45 Bytes | 190916T004107Z | Ben |
| 3981 | Seed | 190915T164657Z | Kamila S |
| 007 | TacO | 190915T041420Z | roblogic |
| 006 | K+Reg | 190810T142653Z | user8505 |
| 012 | Keg | 190810T105111Z | Edgex42 |
| 004 | Deadfish~ | 190611T155302Z | squid |
| 004 | cQuents | 170726T221633Z | Stephen |
| 059 | Whitespace | 180313T205728Z | Kevin Cr |
| nan | Whitespace | 160723T201059Z | ABcDexte |
| nan | Stack Cats | 180313T000530Z | Bubbler |
| 020 | KoopaScript | 180311T085009Z | Jhynjhir |
| 012 | DC | 160722T041627Z | user1921 |
| 007 | QUARK | 180308T174806Z | moonhear |
| 3881 | Sinclair ZX80 4/8K ROM or Sinclair ZX81/ZX Spectrum 27 tokenized BASIC bytes for the ZX80 | 170620T110635Z | Shaun Be |
| 012 | Jotlin | 180228T203102Z | jrtapsel |
| 002 | Canvas | 180219T213344Z | hakr14 |
| 002 | Stax | 180221T064339Z | Weijun Z |
| 053 | brainfuck | 180221T032437Z | X1M4L |
| 053 | Brainfuck | 180220T143317Z | user9882 |
| nan | 180220T144745Z | Brian H. | |
| 003 | Pyt | 180219T181521Z | qqq |
| 050 | Sd | 180218T221138Z | Bolce Bu |
| 017 | jamal | 180218T153328Z | manatwor |
| 042 | Rust | 180218T143618Z | null |
| 011 | Perl 6 | 180218T141642Z | Yytsi |
| 016 | Kotlin | 180204T215625Z | jrtapsel |
| 048 | 17 | 180204T173604Z | Hugh Wil |
| 019 | Python3 19 Characters | 180204T135056Z | Ankit |
| 064 | Forte | 180203T205916Z | DLosc |
| 314 | Pip | 170328T080847Z | steenber |
| 020 | uBASIC | 180130T175157Z | Taylor R |
| 020 | Excel VBA | 170325T194109Z | Taylor R |
| 011 | Julia 0.6 | 180130T162644Z | gggg |
| 017 | FALSE | 180130T152146Z | 12Me21 |
| nan | Kotlin 30?/31/49 bytes | 161115T054626Z | F. Georg |
| 002 | Pyth | 171228T203720Z | Stan Str |
| 016 | Cubically | 171228T194827Z | MD XF |
| 175 | Bitwise | 171228T191814Z | MD XF |
| 010 | Implicit | 171228T190431Z | MD XF |
| 032 | Fortran 95 | 171228T191850Z | Thiago O |
| 017 | ><> | 171120T024109Z | Bolce Bu |
| 027 | TSQL | 171119T222402Z | WORNG AL |
| 026 | Eukleides | 170727T023451Z | brhfl |
| 010 | AnyDice | 170726T221415Z | DanTheMa |
| 003 | anyfix | 170619T181856Z | hyperneu |
| 019 | Python 2 | 170719T181751Z | Rohit-Pa |
| 004 | R | 160721T130826Z | Forgotte |
| 005 | Charcoal | 170712T120338Z | Charlie |
| 020 | Carrot | 170712T120546Z | TheLetha |
| 649 | Commercial | 170712T111327Z | Mayube |
| 030 | BrainFlak | 170707T172201Z | DJMcMayh |
| 003 | MATL | 160721T091623Z | Luis Men |
| 024 | Python 3 | 170707T163743Z | Simon |
| 023 | PHP | 170707T145809Z | Titus |
| 003 | MY noncompeting | 170619T192026Z | Adalynn |
| 012 | Perl 6 | 160721T092248Z | Ven |
| 020 | Swift 3 | 170623T071126Z | A. Pooja |
| 040 | x86 assembly 32bit | 170623T014512Z | Obsequio |
| 017 | Python 2.7 | 170622T220658Z | Joseph |
| 113 | Firebird | 170622T192114Z | Filipe S |
| 026 | AWK | 170622T173453Z | Robert B |
| 009 | TIBasic | 170622T172531Z | Timtech |
| 010 | TLDCode | 170622T171841Z | Justinw |
| 018 | 8th | 170619T191137Z | Chaos Ma |
| 010 | ><> | 170619T175502Z | MercyBea |
| 019 | Perl | 170615T203448Z | xyz123 |
| 014 | JavaScript | 170615T211322Z | ericw314 |
| 015 | Triangular | 170615T165320Z | MD XF |
| 020 | LibreLogo | 170326T071844Z | Grant Mi |
| 020 | Dyvil | 160721T085819Z | Clashsof |
| 007 | Microscript | 170126T155951Z | SuperJed |
| 024 | Python 3 | 170126T154431Z | Jimmy Jo |
| 317 | Python 3 REPL 17 Bytes | 170126T152429Z | MildCorm |
| 008 | Q/KDB+ 8 Bytes | 170126T142254Z | Adam J |
| 026 | Minecraft | 160721T194855Z | Linnea G |
| 036 | Batch | 170124T082716Z | 180Five |
| 019 | SmileBASIC | 170124T062041Z | 12Me21 |
| 009 | QBIC | 160721T144054Z | steenber |
| 009 | VIM | 160724T110710Z | ttq |
| 012 | Cubix | 161117T153839Z | ETHprodu |
| 059 | Brainfuck | 161117T153224Z | Mitchell |
| 057 | Brainf*** | 161116T200834Z | biowease |
| 009 | Vim | 161116T213123Z | DJMcMayh |
| 004 | MATLAB | 161116T211823Z | Ando Ban |
| 009 | Befunge98 | 161116T032127Z | snail_ |
| 003 | Japt | 161115T230242Z | ETHprodu |
| 009 | APL with any ⎕IO | 161115T211101Z | Adalynn |
| 002 | Dip | 161115T055459Z | Oliver N |
| 005 | ASMD | 161115T045725Z | Oliver N |
| 045 | TrumpScript | 161114T223041Z | Aryaman |
| 042 | DARTMOUTH BASIC | 161115T010547Z | Adalynn |
| 064 | Lithp | 161114T225440Z | Andrakis |
| 019 | Python3 | 160723T193225Z | ABcDexte |
| 050 | Java 7 | 161018T141958Z | nul lun |
| 010 | ><> Fish | 161114T092204Z | Teal pel |
| 005 | k | 161114T090224Z | Paul Ker |
| 003 | APL | 161114T061808Z | Niclas M |
| 012 | Vim | 160722T032202Z | Zwei |
| 031 | Hexagony | 161018T162917Z | Sunny Pu |
| 021 | GNU sed | 160901T100149Z | seshouma |
| 003 | Seriously/Actually | 160906T080716Z | user4594 |
| 041 | Brainfuck | 160724T104947Z | primo |
| 065 | Morse code | 160903T110234Z | f1rstgue |
| 003 | Silicon | 160902T175321Z | m654 |
| 006 | Emmet HTML | 160902T124307Z | N.J.Daws |
| 040 | Stata | 160901T163628Z | f1rstgue |
| 046 | TSQL | 160816T125839Z | S.Karras |
| 044 | HTML | 160723T151708Z | NinjaBea |
| 030 | BrainFlak | 160826T115434Z | Leaky Nu |
| 009 | TIBASIC | 160723T145656Z | NinjaBea |
| 009 | R | 160816T160743Z | user5957 |
| 062 | Latex | 160816T104822Z | Chad |
| 012 | Fourier | 160816T105744Z | Beta Dec |
| 037 | Hexagony | 160813T130547Z | X88B88 |
| 035 | Batch | 160721T133002Z | Neil |
| 009 | ShadyAsFuck | 160802T152802Z | flawr |
| 007 | RETURN | 160802T151124Z | Mama Fun |
| 054 | C# | 160802T144541Z | TheLetha |
| 005 | K | 160802T142736Z | Chromozo |
| 052 | Java 7 | 160721T091926Z | Kevin Cr |
| 006 | Excel | 160721T215625Z | Joffan |
| 007 | 𝔼𝕊𝕄𝕚𝕟 | 160724T112746Z | emiflake |
| 020 | UGL | 160724T094959Z | Leaky Nu |
| 067 | C++ | 160723T200017Z | ABcDexte |
| 017 | Python2 | 160721T091433Z | Yytsi |
| 020 | Clojure | 160723T172950Z | Lightbul |
| 031 | JavaScript | 160723T151451Z | Davis |
| 017 | MoonScript | 160723T134844Z | manatwor |
| 019 | CoffeeScript | 160723T123914Z | manatwor |
| 005 | GolfScript | 160723T105800Z | Rocko |
| 018 | Elixir | 160723T104546Z | David Co |
| 005 | Kona | 160722T222621Z | Aearnus |
| 030 | JavaScript | 160722T155211Z | Titus |
| 029 | JavaScript ES6 | 160722T200156Z | Neil |
| 008 | Ruby | 160721T091506Z | Value In |
| 012 | PostScript | 160722T185402Z | Stefan G |
| 034 | Brainfuck | 160722T181115Z | Roger Pe |
| 036 | JShell Java 9 | 160722T172705Z | David Co |
| 055 | LOLCODE | 160722T155331Z | AAM111 |
| 020 | JavaScript with UnderscoreJS | 160722T155446Z | Titus |
| 031 | Verbosy 31 Bytes | 160722T142134Z | Sweeper |
| 013 | golflua | 160722T090453Z | manatwor |
| 052 | Linux ASM | 160722T023359Z | C0D3R3D |
| 007 | Cheddar | 160722T030450Z | Downgoat |
| 058 | Plain TeX | 160722T025114Z | musarith |
| 010 | Maple | 160721T234452Z | DSkoog |
| 017 | F# | 160721T235902Z | asibahi |
| 011 | Julia 0.2 | 160721T135120Z | Elenian |
| 079 | LOLCODE | 160721T215535Z | user5585 |
| 055 | BrainFuck | 160721T213458Z | Cameron |
| 012 | Befunge93 | 160721T213320Z | user5585 |
| nan | Befunge | 160721T204319Z | user2548 |
| 075 | JS | 160721T211840Z | Ronronne |
| 073 | Go | 160721T204827Z | Ronronne |
| 013 | Element | 160721T210133Z | PhiNotPi |
| 019 | JavaScript Node.JS 5 / Harmony / ES2015 | 160721T200239Z | Swivel |
| 012 | Racket | 160721T201359Z | Gibstick |
| 039 | JavaScript using external library | 160721T194936Z | applejac |
| 014 | Scala | 160721T194328Z | leonidv |
| 047 | Excel VBA | 160721T193811Z | tjb1 |
| 026 | Lua | 160721T185446Z | TheCrimu |
| 020 | Swift 3 Jun 20 | 160721T175955Z | CAD97 |
| 015 | Racket | 160721T174957Z | Steven H |
| 003 | Convex | 160721T170109Z | GamrCorp |
| 058 | Brainfuck | 160721T093545Z | xenia |
| 037 | ListSharp | 160721T161036Z | downrep_ |
| 005 | Sesos binary | 160721T131938Z | Leaky Nu |
| 029 | Common Lisp | 160721T144022Z | Rocko |
| 002 | Pyke | 160721T143106Z | Blue |
| 004 | MATLAB/Octave | 160721T143029Z | costrom |
| 066 | Brainfuck | 160721T142848Z | Katenkyo |
| 013 | Perl 5.10 | 160721T140423Z | Sake |
| 023 | PHP | 160721T132933Z | Business |
| 020 | PHP | 160721T140953Z | 1133261 |
| 024 | JavaScript | 160721T134656Z | Kruga |
| 017 | Bubblegum | 160721T135126Z | LegionMa |
| 029 | Atari Basic | 160721T134338Z | user9023 |
| 005 | CJam | 160721T092158Z | xenia |
| 012 | Julia | 160721T132444Z | Riker |
| 005 | PowerShell | 160721T132843Z | AdmBorkB |
| 007 | Fuzzy Octo Guacamole | 160721T131034Z | Riker |
| 005 | Brachylog | 160721T092144Z | Fatalize |
| 017 | Haskell | 160721T090809Z | C. Quill |
| 002 | Pyth | 160721T094035Z | charredg |
| 012 | Bash | 160721T092224Z | manatwor |
| 006 | J | 160721T094003Z | xenia |
| 014 | Bc | 160721T093943Z | manatwor |
| 011 | Groovy | 160721T093415Z | manatwor |
| 013 | Retina | 160721T093221Z | Martin E |
| 013 | Mathematica | 160721T091032Z | Yytsi |
| 012 | jq | 160721T093005Z | manatwor |
| 003 | Dyalog APL | 160721T092927Z | Adá |
| 002 | 05AB1E | 160721T092143Z | Adnan |
| 009 | Actually | 160721T092843Z | Stupe |
| 025 | Lua | 160721T092837Z | Katenkyo |
| 013 | ><> | 160721T091816Z | Aaron |
| 036 | C | 160721T092341Z | xsot |
| 002 | Jelly | 160721T091553Z | TuxCraft |
SAKO, 41 bytes
1)TEKST
1 2 3 4 5 6 7 8 9 10
STOP1
KONIEC
I was quite disappointed when I found this the shortest solution.
SAKO, 46 bytes
*1)DRUKUJ(2,0):I
POWTORZ:I=1(1)10
STOP1
KONIEC
A more normal loop that's printing its variable.
Numbers are separated by spaces.
Alice, 16 bytes
a7PB/ Q \&/ O @
Generates the list of numbers using the fact that 2520 is the smallest number that can be divided by 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10.
5040 is its double and can be calculated in two characters because it is the factorial of 7
a7PB/ Q \&/ O @
7P # Pushes 7! (=5040) on the stack
B # Pops 5040 and pushes all of its divisors in ascending order
/ Q \ # Reverses the stack
a & O # Pushes then pops 10 to repeat 10 times "pop and print line"
@ # Exits
💎
Created with the help of Luminespire.
Bespoke, 111 bytes
when I undergo anxiety or feel stress
I practice numbers,one to ten
it rarely is my cure
but my m.o improves it
Bespoke is a new esoteric programming language I created near the start of 2025. It's similar to my earlier esolang Poetic, in that word lengths are converted to instructions. This time, however, the instructions are part of a stack-based language, with arbitrary-precision signed integers and loop breaking/continuing and functions and everything!
Here is this program in "pseudocode" (which is able to run as Bespoke code - in fact, it's equivalent to the given code!):
PUSH I
CONTROL DOWHILE
DO COPY
OUTPUT N
STACKTOP PLUSONE
PUT XX:TRI BI;OUTPUT CH
DO COPY
PUT XX:I I
STACKTOP LT
Starting from 1, it outputs the number, increments it, and prints a space (one of the printables that takes the least bytes to push/output in Bespoke). This loops while the number is less than 11.
(Normally the while loop would end in something like CONTROL END, but the ends of blocks are automatically filled in if they're at the end of the program!)
Hatchback, 52 bytes
0 0 0 0 1 1 2 0 1 1 0 0 2 10 7 2 0 6 2 65281 2 65535
explanation (since comments are not supported in Hatchback, this code will not work):
0 0 0 (this is just padding)
0 1 1 set $0001 to 1 (for incrementing)
2 0 1 increment $0000 by 1 (add $0000 and $0001)
1 0 print $0000
0 2 10 set $0002 to 10 for doing boolean statement
7 2 0 set $0002 to boolean ($0002 > $0000)
6 2 65281 2 if $0002 is true, set $FF01 to 2 (aka move the program incrementer back to the fifth instruction)
65535 end of program
Hatchback, 50 bytes
this one prints 0 first.
1 0 0 1 1 2 0 1 1 0 0 2 10 7 2 0 6 2 65281 1 65535
Kakoune, 6 bytes
10+"#p
10+ # spawn 10 cursors
"#p # paste # register (holds selection index)
Python 3, 13 bytes
print("1"*10)
- Nobody said you couldn’t output in unary!
- Nobody said you couldn’t use the same digit for two numbers! (123 would include both 12 and 23)
Casio BASIC (fx-9750giii), 16 12 bytes
Seq(X,X,1,10,1
outputs a list containing numbers between 1 and 10
Python 3, 18 bytes
print(12345678910)
kinda cheeky but ¯\ _(ツ)_/¯
punchcode, 30 22 21 bytes
turns out hardcoding it saved some bytes
uncompiled:
-START |
---OOO-O|
---OO-OO|
----O-OO|
---OO-OO|
----O-OO|
---OO-OO|
----O-OO|
---OO-OO|
----O-OO|
---OO-OO|
----O-OO|
---OO-OO|
----O-OO|
---OO-OO|
----O-OO|
---OO-OO|
----O-OO|
---OO-OO|
----O-OO|
---OO-OO|
----O-OO|
+Output, 26 bytes
Decently bearable answer.
1U:loaUo1U+:l:oa=#X_aUo70j
At least it's a one liner, so easy to explain
Explanation:
This answer abuses the l command, which pushes the length of a string. I basically added \0x01 characters to a string until it hit length 10, printing its length every cycle.
1U:loaUo Print 1 and a newline
1U+ Add \0x01 character
:l:o Duplicate, push its length and print it
a=#X_ Check if length is 10, go left if so (ends program), goes right otherwise.
aUo70j Print newline and start another iteration
Edit: I know it's not the best answer and could be optimized, but I went for a more creative solution
Uiua, 7 bytes, 5 characters
+1⇡10
Explained:
⇡10 # make a list of numbers from 0 to 9 (10 numbers)
+1 # add 1 to each number on the list
TI-84 BASIC, 26 bytes
0
While Ans-10
Ans+1
Disp Ans
End
TECO, 9 bytes
` is interpreted as ASCII 27, ESC. Assume current buffer is empty.
10<I1`Z=>
Which outputs
1
2
3
4
5
6
7
8
9
10
Explanation
10< ! do 10 times !
I1` ! insert "1" into buffer !
Z= ! print number of characters in buffer !
> ! end do !
awk - doing it the grade school arithmetic approach
- the OP only said "arbitrary separators" - so empty string (
"") in between the numbers qualify OP's criteria, since OP never mentioned the separators must be positive in length.
awk '$_=int(3E-3^-4)-102' <<<''
12345678910
APL language
⍳10
1 2 3 4 5 6 7 8 9
Swift, 18 bytes
print((1...10)+[])
Self-explanatory. This literally just creates a ClosedRange<Int> from 1 to 10, and then converts it to an [Int] by concatenating an empty array literal. (If we don't do this bit, it'll just output it as 1...10 instead of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].
Pascal, 55 B
This complete program requires a processor compliant with (at least) ISO standard 7185 “Standard Pascal”.
All numerical values supplied to the built‑in write/writeLn routines have an implementation‑defined minimum printing width.
Considering an implementation defines this width to be 8, the program
program p(output);begin write(1,2,3,4,5,6,7,8,9,10)end.
prints
1 2 3 4 5 6 7 8 9 10
If you are a user of the FreePascal Compiler, you need to insert a {$mode ISO} compiler directive comment or supply the ‑MISO parameter to the fpc compiler command.
Otherwise the built‑in minimum width is 1, which just concatenates all numbers without any intervening space.
YASEPL, 10 bytes
=a`1+<}4,9
Labyrinth, 14 bytes
9:"
("
!)
\"@
Prints 1 to 10 separated and terminated by newlines.
9 Push 9
:" Loop in the order of : ( " "
(" duplicate, decrement; exit if top is 0 at (
[9 8 7 6 5 4 3 2 1 0 | ]
!) Loop in the order of ) ! \ "
\" increment, print, print newline; exit if stack is empty at "
@ Halt
Labyrinth, 14 bytes
"):
\ !
@%0#
Prints 1 to 10 separated by newlines. This was the only loop I found that fits in 8 commands, which puts the halt command at a costly position.
"): Loop in the order of " ) : ! # 0 % \
\ ! increment (pushes 1 if empty); duplicate; print;
%0# push stack height (1); multiply by 10; mod (change 10 to 0);
print newline
exit at % when the number becomes zero
@ Halt
Piet + ascii-piet, 24 bytes (3×9=27 codels)
utqrnFecnnneutMj?lkad mm
Outputs ?1?2?3?4?5?6?7?8?9?10 where each ? is \x08. Uses 8 as the separator and the test to leave the loop (>8).
The position of the arrow is a little weird, but it starts at the top left corner facing right. Since the stack is initially empty, the first loop has a bunch of no-ops at random places, and the separator itself is on the stack when it hits DP+ the first time. If the separator is 9, then it goes to the exit path right away.
+ dup dup outN [] no-ops
4 dup + dup outC [8] print ascii 8
> [8] no-op
DP+ [] keep in the direction because 8 % 4 == 0
1 + can be used as a pattern to initialize the loop with a 1 and increment each loop.
1 + [n] start loop with a number
dup dup outN [n n] print n as a number
4 dup + [n n 8]
dup outC > [n n>8] print ascii 8 and make a boolean
DP+ [n] turn to the exit path if n > 8 (after 9 is printed)
Now we can print 10 and exit.
roll [9] no-op; dummy cmd due to fixed colors
1 + outN [] print 10 and exit
I tried to think of some dark magic approaches like "divide the number by 5, use DP+ at the lower left corner and end the program at the lower right corner" (since DP+ 0 and 1 would lead back to the start while 2 would reverse the pointer direction), but I couldn't get it to work.
Nibbles, 1.5 bytes (3 nibbles)
,10
Program saved on disk conists of the 3 hex nibbles d1f:
d = , literal code = range 1..
1 = encode integer
f = integer value 10
Note that Nibbles appends a 6-nibble, not part of the program code, to pad the saved file to a whole number of bytes.
Python 3, 24 19 bytes
print(*range(1,11))
Explanation:
range(1,11) # numbers 1 to 10
* # splat to print
print( ) # print the numbers out
shell commands, 7 bytes
seq 10
or also
jot 10
Thanks.
Go, 52 bytes
import."fmt"
func f(){for i:=1;i<11;i++{Println(i)}}
Go, 39 bytes, prints to STDERR
func f(){for i:=1;i<11;i++{println(i)}}
rig, 3 bytes
rig is a work-in-progress esoteric stack-based language. I'm just having fun with looking for challenges it can already solve, with its few commands.
τr+
is a valid code that prints "1,2,3,4,5,6,7,8,9,10"
Why?
τ - push 10 to the stack [10]
r - push range(10) to the stack [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ - increment every element [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- implicit print
Pushy, 3 bytes
TR_
It's extremely simple:
T % Push 10
R % Generate range (1 to 10, including both endpoints)
_ % Output representation of stack (1 2 3 4 5..)
Java, 47 bytes
()->{for(int i=0;i++<10;System.out.print(i));};
Ungolfed test program
public static void main(String[] args) {
Runnable r = () -> {
for (int i = 0; i++ < 10; System.out.print(i));
};
r.run();
}
36 bytes + imports
()->IntStream.range(0,11).toArray();
Doesn't include imports :(
Flobnar, 22 bytes
+<> v:
,-|\@1
.9>> +
:
\@1
> + Set TOS to 1 on init (and increment TOS on every iteration)
:
:
+< Print TOS as number, print 0 (return value of `.`) as char,
,-| and check if TOS - 9 is zero
.9
:
> v
| @1 Return to start with updated TOS if nonzero,
> + evaluate to TOS+1 (10) otherwise (which is printed at the end)
:
Cognate, 16 bytes
Print Range 1 11
Pretty self-explanatory, but here's a fuller version:
Print the Range of numbers from 1 up to but not including 11
(Lowercase words are treated as comments.)
Aussie++, output to STDERR, 29 28 bytes
It turns out that causing errors is shorter than any straightforward way of doing it.
G'DAY MATE! 1 2
4
6
8
_
Tested in commit 9522366. The trailing newline is required. Produces the following errors:
[line 1] OI MATE! EXPECTED ; BUT GOT '2'
[line 3] OI MATE! EXPECTED ; BUT GOT '4'
[line 5] OI MATE! EXPECTED ; BUT GOT '6'
[line 7] OI MATE! EXPECTED ; BUT GOT '8'
[line 9] OI MATE! EXPECTED ; BUT GOT '_'
[line 10] OI MATE! EXPECTED ; BUT GOT 'EOF'
Maybe I misinterpreted the challenge, but it didn't specify that you had to use the same separator for all numbers.
Aussie++, output to STDERR with consistent separator, 30 bytes
G'DAY MATE!;
;
;
;
;
;
;
;
;
;
No trailing newline is required. Produces the following errors:
[line 1] EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT ';'
[line 2] EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT ';'
[line 3] EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT ';'
[line 4] EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT ';'
[line 5] EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT ';'
[line 6] EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT ';'
[line 7] EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT ';'
[line 8] EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT ';'
[line 9] EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT ';'
[line 10] EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT ';'
Aussie++, output to STDOUT, 41 bytes
G'DAY MATE!
GIMME "1 2 3 4 5 6 7 8 9 10";
Again, no trailing newline is required.
Ly, 13 4 bytes
`9`R
I found a better way. :)
` incrementing the empty top of stack pushes a 1
9 push 9 onto the stack
` increment the top of stack to get "10"
R generate the inclusive range of int between the top 2 stack entries
The stack entries are printed as numbers by default when the code exits.
Swift 5.6, 18 bytes
print([_](1...10))
SwiftFiddle link, since TIO uses Swift 5.0.
Same method as this Swift 3 answer, but using a new syntax for type inference. [Int] is short for Array<Int>, and Array<_> means "an array, but infer the element type" (mostly the same as just Array). Therefore, [_] is short for Array. Go figure.
Piet, 40 Codels
Code runs in a tight loop where the output is printed, followed by 32 ASCII. Previously printed number is compared to 9, and the output is used for both incrementing the counter and redirecting the code execution flow. After 10 increments, the code will get stuck in an infinite loop, performing invalid ops.
Julia 1.7, 14 bytes
print((1:10)')
1:10 returns a Range. Note that in Julia 0.2 we can just use print(1:10). This does not work in later versions (I've tested this starting from Julia 0.4).
We could use print(collect(1:10)). But this is costly. But we can use a trick by using the ' transpose operator.
There is also an answer for Julia 0.6 which uses show.(1:10) as this prints 1-10, it prints additional stuff in newer Versions of Julia due to the nature of broadcasting, namely,
12345678910
10-element Vector{Nothing}:
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
Headascii, 50 bytes
++++[]]]][]]]+O^+O+O+O+O+O+O+O+ODONE.{UPN)!@}:R-P!
Try it here! Code will need to be copied and executed like this:
erun("++++[]]]][]]]+O^+O+O+O+O+O+O+O+ODONE.{UPN)!@}:R-P!")
Outputs each number separated by newline. Nontrivial challenges scare me :')
++++[]]]][]]]+O^+O+O+O+O+O+O+O+ODONE.{UPN)!@}:R-P! full program
. code block delimiter
++++[]]]][]]]+O^+O+O+O+O+O+O+O+ODONE block 0
O O O O O O O O O O send
++++[]]]][]]]+ 49 (ascii 1)
+ 50 (ascii 2)
+ 51 (ascii 3)
+ 52 (ascii 4)
+ 53 (ascii 5)
+ 54 (ascii 6)
+ 55 (ascii 7)
+ 56 (ascii 8)
+ 57 (ascii 9)
^ D 49 (ascii 1)
NE to code block 1
{UPN)!@}:R-P! block 1
{ } Loop
N) : Until last value
UP Put value on string register
!@ Print and clear string register
R Recall last value (49)
- Minus 1 (48, ascii 0)
P! Concatenate to string register and print
Sending inputs to code block to loop print saves 5 bytes over printing each individually, but it might be possible to save more bytes by doing some sort of for-loop type structure from the beginning. Storing 9 as well as 48 seems expensive, though.
dotcomma, 67 bytes
[[[[[[[[[[.,][.].,][.].,][.].,][.].,][.].,][.].,][.].,][.].,][.].,]
The shortest is the direct approach: Put a 1 on queue and then, nine times put the previous value plus 1 on the queue. Output implicitly.
<script src="https://combinatronics.com/Radvylf/dotcomma/master/interpreter.js"></script><script src="https://code.jquery.com/jquery-3.5.1.min.js"></script><script>$(document).ready(function () {$("#btnInterpret").click(function () {$("#txtResult").text(interpret($("#txtCode").val(), $("#txtInput").val(), $("#lstOutputAs").children("option:selected").val()));});});</script><style>.textBox {background-color: white;border: 1px solid black;font-family: Courier New, Courier, monospace;width: 100%;}</style>Code: <textarea id="txtCode" type="text" class="textBox" style="height: 200px">[[[[[[[[[[.,][.].,][.].,][.].,][.].,][.].,][.].,][.].,][.].,][.].,]</textarea><br />Input: <textarea id="txtInput" type="text" class="textBox"></textarea><br /><input id="btnInterpret" type="button" value="Run" />Output as: <select id="lstOutputAs"><option value="">Number array</option><option value="true">String</option></select><br />Result:<br /><div id="txtResult" class="textBox" style="overflow-wrap: break-word"></div>
dotcomma, 67 bytes
[[[[[[[[[[.,][.].,][.].,][.].,][.].,][.].,][.].,][.].,][.].,][.].,]
A simple approach which nests [[...][.].,], which adds one to and then pushes each number from one to ten. The "root" of this is [.,] which pushes one.
Explanation:
In dotcomma, dots and commas are the only operators. Their behaviors are extremely context dependent; . will be 1 when preceded [, or it can be used for adding, or it can be used in a loop, or a conditional.
In the case of [.,], the . is a constant for 1, and the , takes that and pushes it to the stack. After this, [.] is another 1 constant, wrapped in a block. The . after this takes the previous blocks, [.,] and [.], and adds them. This results in 2, which is pushed by ,. This is nested with another [.].,, which continues up to 10.
Knight, 16 bytes
;=w 0W>10wO=w+1w
# set w to 0
; = w 0
# loop while w < 10
: WHILE > 10 w
# Output ++w
: OUTPUT (= w + 1 w)
Factor, 15 bytes
10 [1,b] stack.
10 [1,b]Create the range [1,10].stack.Prettyprint each element of a sequence.
Hexagony, 16 bytes
9{$:':</)!'/>;}}
Expanded:
9 { $
: ' : <
/ ) ! ' /
> ; } }
. . .
Admittedly, this solution feels a bit questionable. Its output is
123456789 10
This is each number from 1 to 10, separated by the Unicode characters of their values. So, for example, 9 and 10 are separated by tab, which is Unicode character 9. Technically the problem doesn't specify that all the separators must be the same, though perhaps its implied. If you feel this is invalid, here's a 17 byte version that uses lowercase e as a separator (nothing special about e, it can be any character that isn't a special character in Hexagony).
9{.e:'<)!'://}};>
Here's another 17 byte alternate that prints the numbers separated by newlines, but never terminates (it prints 1 to 10 and then runs forever without printing anything else).
_10<>-<{)!'//=;{>
I'll just explain the 16 byte code because the others are just minor variations on it. Starting in the top left and moving right, 9}$ writes nine into a memory slot, then moves to an adjacent memory slot, and uses $ to jump into the main loop on line 3. The main loop starts with )!, which increments the
value in the current memory slot and then prints its decimal value. This cell will cycle through the values 1 to 10, printing each. Then, ': backs up to a new memory slot and divides 9 by the number that was just printed. Because Hexagony uses integer division, the result will be one as long as the number is less than or equal to 9, and 0 once its greater. This gives a termination condition, as another ': backs into an empty slot and divides 0 by this number. As long as this value as 1 this calculation will be inconsequential, but when it equals zero, the program will crash trying to divide by zero. After this, }}; moves back to the incrementing memory slot, prints it as a Unicode value, and then reenters the main loop.
CSASM v2.4.0.2, 43 bytes
func main:
push [1..10]
conv ~arr
print
ret
end
Prints [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] to the console.
Explanation:
func main:
; Push a Range
push [1..10]
; Convert it to an array: [1..10] -> [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
conv ~arr
; Print the CSASM representation of that array
print
ret
end
end
If the output had to only be the numbers 1 through 10, that would be this 72 byte program:
func main:
lda 1
.lbl a
push $a
print.n
inc $a
push 11
push $a
sub
brtrue a
ret
end
Explanation:
func main:
; Store 1 into $a
lda 1
.lbl a
; Print $a
push $a
print.n
; Stop looping if 11 - ++$a == 0
inc $a
push 11
push $a
sub
brtrue a
ret
end
```
BRASCA, 9 bytes
1lr,[nlo]
Explanation
1lr - Push range(1,10) to the stack
, - Reverse the stack
[ ] - While the stack isnt empty:
n - Output the next number...
lo - and a newline!
Grok, 13 bytes
}q
{p1+YzP9>!
BitCycle -u, 40 bytes
v0 ~
v1~/
AB~
v000000<
AB\ 000^
v =@
!1<
Explanation pending. I need to sleep first.
(I also found a 36-byte program that outputs 0 through 9, but I haven't found a good way to turn it into 1 through 10.)
Flurry, 38 bytes
<({<({})({}){}>}){}>{(<><<>()>{})}({})
Verification
$ ./flurry -inn -c "<({<({})({}){}>}){}>{(<><<>()>{})}({})"
1 2 3 4 5 6 7 8 9 10
Since multiplication and exponentiation is much cheaper than increment, addition, and high number literals, 9 (being 3**2 or 3*3) is much cheaper to produce than 10. Since producing 1 is almost free (via popping from empty stack), I push a 1 manually and then loop 9 times to push 2 through 10. Then the stack is printed in integer mode, from bottom to top.
<({<({})({}){}>}){}> Number 9
<...> Function composition (multiply numbers)
(...) Push and return the number inside...
{<({})({}){}>} The number literal 3
{} Pop 3 back
evaluates to 3 * 3 = 9
{(<><<>()>{})} Lambda function: Increment, push and return
{...} Lambda, which implicitly pushes its argument
(...) Push and return the result of...
<><<>()> Increment
{} the argument
({}) Initial value 1, pushed to the stack
The entire program is roughly 9 (\x. push (succ x)) (push 1)
Intcode, 44 42 bytes
-2 bytes thanks to rootbeersoup
204,8,9,8,1205,8,0,99,1,2,3,4,5,6,7,8,9,10
Isn't it unfortunate that a just-hardcode solution outgolfs the other intcode answer by six bytes?
Commodore BASIC, method 1 (28 bytes)
0?1,2,3,4,5,6,7,8,9,10
Method 2 (27 26 bytes)
0FORI=1TO10:?I:NEXT
Method 3 (40 39 bytes)
0I=1
1?I:I=I+1:IFI<11THEN1
Method 4 (32 31 bytes)
0?I:I=I+1:IFI<11THEN0
I=1:GOTO0
Method 5 (20 bytes)
0?"12345678910
Method 6 (25 bytes) CBM BASIC V2 only [C64/C64Mini or VIC-20]
0I=I+1:?I:ON-(I<10)GOTO
I'm working out the memory used with ? 38911-(fre(0)-65536*(fre(0)<0)) on a Commodore 64.
Rogex, 27 bytes
90B300d00901e00100701a20f00
Explained
90B 300 d00 # Set the loop value to 11
901 # Set the buffer to 1
e00 # While the buffer isn't equal to 11
100 701 # Print the buffer then increment it
a20 # Print a space
f00 # End loop
Rogex answer number 2! Also, my 101st answer! (´• ヮ •`)
naz, 50 bytes
1x1f1a1o2x1v0m9a1a1o1v0x1f1f1f1f1f1f1f1f1f8s1o1s1o
Explanation (with 0x commands removed)
1x1f # Function 1
1a1o # Add 1 to the register and output
2x1v # Store the new value in variable 1
0m9a1a1o # Output a newline
1v # Read variable 1 into the register
1f1f1f1f1f1f1f1f1f # Call function 1 nine times
8s1o # Subtract 8 and output
1s1o # Subtract 1 and output
GolfScript, 6 bytes
It hasn't been done? Then great. Generates 0 to 10 and removes 0, then it evaluates.
11,1>`
Spice, 55 bytes
My solution is posted as to the language spec, which currently fails because of an interpreter bug. To run against the interpreter the score falls to 63 bytes due to 2 NUL statements being required.
;a@ADD a 1 a;SWI a 10 0;LOD std::sort.spice ^a a;OUT a;
Or with the additional NULs.
;a@NUL;NUL;ADD a 1 a;SWI a 10 2;LOD std::sort.spice ^a a;OUT a;
Un-golfed Explanation
;a@ - declare variable 'a'
ADD a 1 a; - ADD a[0] to 1 and insert at a[0], empty "a" implicitly 0
SWI a 10 0; - If a[0] < 10, jump to line 0 (ADD...)
LOD std::sort.spice ^a a; - Use std lib to sort a 1->10
OUT a; - Output a
Wren, 28 bytes
System.write((1..10).toList)
Explanation
System.write( ) // Output
(1..10) // Numbers from 1 to 10
.toList // Converted to a list
Intcode, 49 bytes
4,15,1001,15,1,15,8,15,16,14,1006,14,0,99,-1,1,11
Why am I still doing this? Because it's fun. That's why.
Poetic, 163 bytes
this is asking a lot
o,i admit i was a victim
i was tired of this situation
o,i had a break
i couldnt be sicker of it
thats a very different outcome than i thought
Outputs the numbers from 1 to 10, separated by ASCII 0 (NUL) characters.
For being such a simple type of program, this was an interesting challenge to golf.
Hexadecimal Stacking Pseudo-Assembly Language, 54 bytes
203039400000120000201A8540000012000020000A400000120000
203039 input 0x3039 (decimal 12345)
400000 push that on stack
120000 print it
201A85 input 0x1A85 (decimal 6789)
400000 push that on stack
120000 print it
20000A input 0xA (decimal 10)
400000 push that on stack
120000 print it
PHP (with goto) - 46 38 34 bytes
More byte-saving suggestion from Shaggy:
<?php Z:echo@++$i;if($i<10)goto Z;
And people say that goto is the work of the Devil. Or something.
PHP (goto-less) - 30 29 bytes
<?php while(@$i<11)echo@$i++;
PHP - 11 bytes
12345678910
Well, someone had to?
Perl 5, 13 bytes
say for 1..10
Example execution
perl -E 'say for 1..10'
Putt, 2 bytes
X:
X # Roman Numeral for 10
: # Ranger operator pushes [1..N]
# Putt implicitly prints
Turing Machine Language, 199 bytes
0 * 1 r 1
1 _ _ r 2
2 * 2 r 3
3 _ _ r 4
4 * 3 r 5
5 _ _ r 6
6 * 4 r 7
7 _ _ r 8
8 * 5 r 9
9 _ _ r a
a * 6 r b
b _ _ r c
c * 7 r d
d _ _ r e
e * 8 r f
f _ _ r g
g * 9 r h
h _ _ r i
i * 1 r j
j * 0 r k
MarioLANG, 34 27 25 bytes
+<
:"
+
:
+
:
+
:
+
:!
=#
Thanks to Jo King for -7 -9 bytes!
code:
Mario falls down, incrementing and saying his number five times, then he steps on the elevator, rides up and falls down again, incrementing and saying his number another five times. Then he walks left and falls out of the code.
14 bytes shorter than the easy way:
39 bytes
+:+:+:+:+:+:+:+:+:+
==================:
Clojure REPL, 12 bytes
(range 1 11)
I think this is self explanatory code
Keg, 5 bytes
I am too lazy to change my answers to conform the new code page, unless I get notified.
ėÏ_(.
Push 10(saving a byte), take iota [10..0], remove last, and then print.
ROOP, 15 bytes
123456789
h(10)
Solution with hardcoded numbers, I'm still trying to find a shorter program.
In this language each digit becomes an individual object. Number 10 is written in parenthesis to make it a single object. The operator h prints all objects that are currently in the program, separated by a space, then halt.
Brian & Chuck, 17 bytes
1 1{?
!{.+>-?>.-.
code:
Brian:
1 1 ("1", 9, "1") constants
{? restart Chuck's code
Chuck:
{ Move Brian to the leftmost character
.+ Print and increment character
>- decrement counter
? if counter is greater than zero, switch to Brian (restart Chuck's code)
>.-. print 10
Javascript 45 Bytes
alert("10charstrn".split("").map((e,i)=>i+1))
This is currently quite poor, but if there happens to be a JS constant which is an array of length 10, this could improve a lot.
Seed, 4232 4039 3981 bytes
To be golfed.
11 806065440241409087125357198607542800075970572928765093042958164984128856153119364694304946533565974155065813564463607464907294493213625991570210498180131922642836049048379926678214090306958078942950505666942158861663318082805922649360548872276728753092705551896201785489318797454097467866454815778688721780170362909784978852186756623253868868917034035335528463229661772327867673360158173714723733025733656646487909489808220640703644162017799947346882823939914644265408484708544566367174322747059393061445510836708923637982737011363312927325448282786060215442674975310709523697911998742881715764878830975686475127091070151990734113230052589483007904386955837951416230150553553131824081272209795780490205576443141598594094128682959852257277648831764416301409205933849585487706444517684177487650836580944108733813423567329150282262574305747736976499413900964122878760201959007114022481011295839141271138446203186069264532462250500186116493184286012088625239590991537830133224608224949348931933311034455280978164515936125672561757104517575527099692465553902153481143524868360127998596923638301974413167583429193105287970847431486813381197765539764522094782334194830005111603128673518265195317929281022739571069159575305773074583173243911197334517405412628068284686691469982559791730541223895403558031955848768117060646768348463561209935808045637507281128179915889035768211511504144114447348017724691523076211025635445333081644368060430405389019848215116047520242946447978917490619742817523907421559319563570816232286092378925478777387843124296450405990835394943021252863488969545687903232603331252281246680860082655523490245738107512918342578050153655018310720283275985429190062871812385817909146120892975424714212971890662091259299688100739835789852338707333214399083184648552682989269071097042033924364887158088125417342061047907455595001558776113845342454604060641417114322284932278126981432767955018317987960683429833483125151020913178712494155310545261553444170641615117711305756617133820567957209040625095889033833683868477968222981257864647555382502179925116320599028456728151421211950504164587366555426478479957000176097833838329163859553682184378396176530388849222864560228925976975341162944244301834305126128097819354250219559409487388887032429560483598135806164050794728591878728116747953265919795701481292222092677282626562421120330436952746759320383166496345689472683465785160396471114988424810146619802843389460581036625456336614635949441077117888570209114560201469774858952308539634363125726651042307946127813908314293240378846347559662225224004298822713302904050471977675138246925540751643515879128105969891674920959645532198204680833150120401421252646736795292132103275342152265451058336500878555688383134027160586652276624279294501247326175308886148638933724425782375226226354458022684652099014849380343822015940473137950787091045988775407006084669595433268270085699081145780497235745383972369977375564713816849012360495596752065665250235877504147680897910657602532177993907221958136528121236676455264099257048759319470710174615005668917675853889646496531814039709503285164186416096735666867062585670181891889551756178657495723233678891549411496581200696462439988553007997103954989290028776888309286564702133992674291744804531900851060090385178725409757099606879757766288322010567612896350258272282241111517435795569303408578713936760574865986977532034796036053889911992836923158428809242575557886427002935479153509101800373188079516076598125218940752155364580400861924119667725548877677649837117601878482958020472764206345843076482381692875591020886968748894499648171413242376922343979630964910668516043571246988639289969853916731069660002514237788846617524295024699798200028558752532671916185460167291108476912591550362203490594401624213451585637461718363114331483866061411154610681167668195013207060532734483192219734129165226320299742868143084807270641847983148272764305800992489421803505337228286598600236556437401089147741524552516814465259338644189950504662
TacO, 7 bytes
@%10
i
try it online!
The number 10 is the first branch of the looping construct %, so TacO runs the second branch, which just contains i, 10 times, giving i numbers 1-10.
(K+R)eg, 6 bytes (SBCS)
6 bytes:
\
ï_(.
11 bytes:
9(9|:"1-)1$
How it works
9(9|:"1-) # A countup program from 1 to 9 and then (astonishingly) adds a 0; I have no idea how it works.
1 # Push 1
$ # Swap top 2 items
# The stack is implicitly outputted.
Keg, 12 bytes
1(91+|:. ,1+
Output is separated by spaces
How it works
1 Pushes 1
( Begins for loop
91+| For loop will run 10 times
:. Output the top element of the stack
, Output space
1+ Add one to the top element of the stack
End bracket gets added automaticly
cQuents, 6 4 bytes
#t&$
Explanation
#t Set default input (n) to 10
& Mode: Sequence 2 (print first n items in sequence, 1-indexed)
$ Each item in the sequence is the current index
Whitespace, 61 59 bytes
[S S S T N
_Push_1][N
S S N
_Create_Label_0][S N
S _Duplicate][T N
S T _Print_integer][S S S T N
_Push_1][T S S S _Add][S N
S _Duplicate][S S S T S T S N
_Push_10][S N
S _Duplicate][T N
S S _Print_char][S N
T _Swap][T S S T _Subtract][N
T T S N
_Jump_to_Label_1_if_negative][N
S N
N
_Jump_to_Label_0]
Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Explanation:
Command Explanation Stack STDOUT STDERR
SSSTN Push 1 [1]
NSSN Create Label_LOOP [1]
SNS Duplicate (1) [1,1]
TNST Print as integer [1] 1
SSSTN Push 1 [1,1]
TSSS Add (1+1) [2]
SNS Duplicate (2) [2,2]
SSSTSTSN Push 10 [2,2,10]
SNS Duplicate (10) [2,2,10,10]
TNSS Print as character [2,2,10] \n
SNT Swap top two [2,10,2]
TSST Subtract (10-2) [2,8]
NTTSN Jump to Label_1 if neg. [2]
NSNN Jump to Label_LOOP [2]
SNS Duplicate (2) [2,2]
TNST Print as integer [2] 2
SSSTN Push 1 [2,1]
TSSS Add (2+1) [3]
SNS Duplicate (3) [3,3]
SSSTSTSN Push 10 [3,3,10]
SNS Duplicate (10) [3,3,10,10]
TNSS Print as character [3,3,10] \n
SNT Swap top two [3,10,3]
TSST Subtract (10-3) [3,7]
NTTSN Jump to Label_1 if neg. [3]
NSNN Jump to Label_LOOP [3]
...
SNS Duplicate (9) [9,9]
TNST Print as integer [9] 9
SSSTN Push 1 [9,1]
TSSS Add (9+1) [10]
SNS Duplicate (10) [10,10]
SSSTSTSN Push 10 [10,10,10]
SNS Duplicate (10) [10,10,10,10]
TNSS Print as character [10,10,10] \n
SNT Swap top two [10,10,10]
TSST Subtract (10-10) [10,0]
NTTSN Jump to Label_1 if neg. [10]
NSNN Jump to Label_LOOP [10]
SNS Duplicate (10) [10,10]
TNST Print as integer [10] 10
SSSTN Push 1 [10,1]
TSSS Add (10+1) [11]
SNS Duplicate (11) [11,11]
SSSTSTSN Push 10 [11,11,10]
SNS Duplicate (10) [11,11,10,10]
TNSS Print as character [11,11,10] \n
SNT Swap top two [11,10,11]
TSST Subtract (10-11) [11,-1]
NTTSN Jump to Label_1 if neg. [11] Label_1 not found error
Whitespace,
71 bytes, thanks to LeakyNun,
63 bytes, thanks to Kevin
Spaces substituted with S, tabs with T, linefeeds with L:
(extra spaces inserted for readability)
SSSTL LSSTL SLS TLST SSSTSTSL TLS SSSSTL TSSS SLS SSSTSTTL TSST LTSSL LSLTL
Output:
1
2
3
4
5
6
7
8
9
10
Stack Cats, 28 + 4 (-nm) = 32 bytes
-(:!_:!_:-_-_]>{<:_-!:]}]<)-
Stack Cats is a reversible esoteric language by Martin Ender. All of its commands can be reversed by applying the command's mirror image, and the whole code itself must be the mirror image of itself. Since half of the code is always redundant, it has -l and -m flags which allow to omit half of the program. -m appends the mirror image to the right (except the center character), so the full program is -(:!_:!_:-_-_]>{<:_-!:]}]<)-(>[{[:!-_:>}<[_-_-:_!:_!:)-.
Stack Cats operates on an infinite tape of stacks, all of which are initially empty with infinite amount of implicit zeroes at the bottom. Here is a summary for the relevant commands:
-Negate the top.!Apply bitwise NOT to the top.:Exchange top two elements of the current stack._Popa, Popb, Pushb, Pushb-a.>,<Move the cursor right or left.],[Move the cursor right or left, along with the top. (Also called "Push")(,)Enter or exit a loop if the top is strictly positive.{Enter a loop and remember the top.}Exit a loop if the current top is equal to the remembered top.
Also, due to the limitations of the language, the input/output occurs only at the start/end of the program. At the start of the program, each input is pushed to the initial stack, which has a -1 at the bottom. At the end of the program, all values on the stack are printed from top to bottom, with optional -1 at the bottom ignored. So this program starts with a single -1 on the stack, and ends with 1..10 on the current stack.
How the code works:
Code Stack Description
[-1]
-( [1] Negate the top; Enter the loop
:!_ [1 0]->[1 -1]->[1 2] Swap top two (with implicit zero); Bit-NOT; Subtract
:!_ [2 1]->[2 -2]->[2 4] Same
:-_ [4 2]->[4 -2]->[4 6] Swap; Unary minus; Subtract
-_ [4 -6]->[4 10] Generate 10
]> [4] [10] [*] Push 10 to a new stack; Move right again
{ Remember 0
<: [4] [n 0*] [...] Swap with implicit zero
_-! [4] [n n-1*] [...] Generate n-1
:] [4] [n-1] [... n*] Push n to the right
} Loop while n is not zero
]< Remove last zero
) Top is 1; Exit the loop
-(...)- Skip the rest
There is a standard construct <(...)*(...)> which allows to ignore half of the program, in order to program more effectively by human. I used a similar one -(...)-(...)- which utilizes the initial -1, but it only works with no-input programs and the final top should be strictly positive.
Ignoring half of the program is quite a waste of space, so there is an open bounty for more efficient golfing with both halves. I'm aiming for this in the long run, though it's not yet clear how to even start tackling the problem.
KoopaScript, 78 (28, 20) bytes
def i a if \%va is \%v set a 0;setath a \%va + 1;if \%va smaller 11 print \%va
This prints the numbers 1 to 10, as well as a lot of information about the currently running code (because reasons). KS doesn't actually have a way to break loops yet, so this keeps running until the interpreter is reloaded. It stops printing at 10, though.
def i a - Define a function with the name i and call it 1000/NaN (i.e. many) times a second
if \%va is \%v - if the variable with the name a is undefined,
set a 0; - set it to 0
setath a \%va + 1; - set the variable a to <the variable with the name a> + 1
if \%va smaller 11 - if the variable with the name a is smaller than 11,
print \%va - trace the variable with the name a
To avoid printing debug info, either load this in an init script, or use this slightly longer (90) version that disables logging:
def i a set verbose;if \%va is \%v set a 0;setath a \%va + 1;if \%va smaller 11 print \%va
set verbose; - set the variable called 'verbose' (which handles whether to trace debugging stuff) to ""
Alternatively,
print "1 2 3 4 5 6 7 8 9 10"
This is only 28 bytes and technically does what the specification entails. Other commands, e.g. if, display all the numbers, but, as it's caused by an error in the program, it doesn't display if logging is disabled.
Technically,
1 2 3 4 5 6 7 8 9 10
prints all the numbers with commas between them, in the debug log. That brings it down to 20. I guess it's up to the reader (stacker? golfer?) to decide which one is the most correct
DC, 12 bytes
...a little bit mean now...
[zzpA>L]dsLx
Unrolled:
[ # start string constant
z # push stack length (0 on 1st cycle)
z # push stack length (1 on 1st cycle)
p # print top of stack
A>L # if 10(decimal) < tos: execute L
] # end string constant, push it
d # duplicate the string
sL # store a copy in L
x # execute tos (which is the other string copy)
One of the z (push stack length) operations has no corresponding operation which takes it from the stack. This way the stack grows with each iteration by one. This is abused as the loop counter.
This loop starts with an empty stack, so the 1st z pushes 0 in the 1st iteration so the printing happens after the 2nd z which correspond to duplicating the result of 1+d in the version below. This way the comparison needs to test for bigger than 10 here instead of bigger than 11 below.
DC, 14 bytes
Just straight forward...
1[p1+dB>L]dsLx
Unrolled:
1 # push 1
[ # start string constant
p # print top of stack
1+ # add 1 to tos
d # push tos (duplicate)
B>L # if 11(decimal) < tos: execute L
] # end string constant, push it
d # duplicate the string
sL # store a copy in L
x # execute tos (which is the other string copy)
QUARK, Non competing 7 bytes
5.625 bytes encoded.
1 10⋯
This is incredibly simple. Just pushes 1 and 10 to the stack, and creates a inclusive range out of them. The interpreter prints out the contents of the stack when the program ends, so no print command is needed. (Plus the print command doesn't work with arrays yet, and prints out a garbled mess, so :P)
Sinclair ZX80 (4/8K ROM) or Sinclair ZX81/ZX Spectrum (27 tokenized BASIC bytes for the ZX80, 38 tokenized BASIC bytes for the ZX81)
1 FOR I=1 TO 10
2 PRINT I
3 NEXT I
Or (direct mode, probably works on all 8-bit variants of BASIC):
PRINT 1,2,3,4,5,6,7,8,9,10
Sinclair ZX Spectrum (and other BASIC variants except the ZX80/ZX81):
1 FOR I=1 TO 10:PRINT I:NEXT I
Simple, no?
Jotlin, 15 12 bytes
p((0..9)+10)
Gets the numbers 0..10, makes a list out of them, and then prints the result
brainfuck, 53 bytes
++++++++++[->+++++>+>+<<<]>-->-[-<+.>>.<]<--------.-.
Explanation :
++++++++++ # set initial counter to ten
[->+++++>+>+<<<] # creates ascii cell, second counter, and newline
>-->- # fixes ascii and counter cell values
[-<+.>>.<] # prints digits one through nine
<--------.-. # prints the ten
Output:
1
2
3
4
5
6
7
8
9
10
Brainfuck, 53 bytes
++++++++[->++++++>+>++++<<<]>>+[-<+.>>.<]<--------.-.
Javascript (potentially non-competing)
As a function (6 bytes):
_=>110
Full program (10 bytes):
alert`110`
This prints all number from 1 to 10 inclusive in binary...
If you closely read the question, there is never any mention about mandatory separators (thus allowing 123456...) nor the output's base...
Sd, 50 Bytes
++++++++++@**********.-/.-/.-/.-/.-/.-/.-/.-/.-/.!
How it works:
++++++++++ | Set variable 1 to 10
@ | Mark read location
********** | Set variable 2 to 10
. | Replace the instruction in position given by variable 2 with the ascii character given by variable 1
-/. | Subtract one from each variable and repeat
-/.-/.-/.-/.-/.-/.-/.-/. | Repeat some more
! | Print all values before the @ (as ascii)
jamal, 17 characters
{@for i/1..10/i }
Sample run:
bash-4.4$ jamal.pl number.jam
1 2 3 4 5 6 7 8 9 10
Rust, 42 bytes
fn main(){for i in 1..11{print!("{},",i)}}
Perl 6, 11 bytes
Two solutions with the same count:
print ^10+1
and
print 1..10
Output: 1 2 3 4 5 6 7 8 9 10
Try both of them on Try It Online!
Kotlin, 16 bytes
print((1..9)+10)
Beautified
print((1..9)+10)
Test
fun f() =
print((1..9)+10)
fun main(args: Array<String>) {
f()
}
TIO
17, 48 bytes
17 was made after the challenge was released, so it is not competing, though it still scored worse than most other answers because it isn't a golfing language, or very usable at all.
Outputs 1 to 10 seperates by \x11 (ascii value 17)
0{#
1 +
:
10 @
9 >
0 @
# $$
$}777{0 10 @
0 0 @}
Block 777(first block run): Initialises value 17 to 0. Runs block 0
Block 0: Loads value 17(relies on returning of 17 from stack when empty stack), adds 1, duplicates, stores at 17, if value > 9 pushes 1, else 0, stores value at 0, loads from 17, prints number, print ascii charater 17(relies on returning of 17 from stack when empty stack again)
Python3 - 19 Characters
print(*range(1,11))
Output: 1 2 3 4 5 6 7 8 9 10
Forte, 64 bytes
12PRINT42-41:LET42=42+1:LET11=11+3
13LET99=11
99LET12=12+3
40END
How?
In Forte, you do things by redefining numbers. For example, LET 4=5 is a statement that defines 4 to be 5. From now on, anytime 4 occurs in the program, it is replaced by 5--even as the result of expressions like 2+2. There are no looping constructs in the language; control flow is accomplished by redefining line numbers.
With that introduction, let's look at what this program does.
The first line executed is line 12. This prints 42-41, which (currently) results in 1. Next, it redefines 42 to be 42+1--that is, 43. From now on, anytime 42 occurs in the program, we'll actually use the value 43. Finally, it redefines 11 to be 11+3--that is, 14. This is setup for the loop we're about to enter.
- Redefinitions: 11->14; 42->43
Line 13 is executed next. It redefines 99 to be 11--except 11 has previously been redefined, so 99 actually becomes 14.
- Redefinitions: 11,99->14; 42->43
Now, the previous instruction has an effect on the control flow, because 99 happens to be a line number. Line 99 is now considered to be line 14, and thus we execute it next (rather than line 40, which would otherwise have come next). This line redefines 12 to be 12+3--that is, 15.
- Redefinitions: 11,99->14; 12->15; 42->43
And now the next instruction is the newly christened line 15, which prints 42-41 again... except that 42 is now 43, so it actually outputs 2. It then redefines 4243 as 44 and 1114 as 17.
- Redefinitions: 11,14,99->17; 12->15; 42,43->44
The next instruction is line 17 (the original line 99), which redefines 15 to be 18. And so lines 12/15/18 and 99/11/14/17 keep alternating back and forth, incrementing each other and printing ever-increasing values of 42-41, until we reach line 39. This prints 10 (42 now having reached a value of 51), redefines 42 and 11 again (but that won't matter), and then we move on to the next statement, line 40--which ends the program.
Simple, right?
Pip, 3+1 = 4 bytes
\,t
Runs with the -n flag to separate the output with newlines.
Explanation:
\, Inclusive range of 1 to
t 10
uBASIC, 20 bytes
Anonymous function that takes no input and outputs to the console
0Forx=1To10:?x:NextX
Excel VBA, 20 Bytes
Anonymous VBE immediates window function that takes no input and outputs to the VBE Immediates window
For i=1To 10:?i:Next
FALSE, 18 17 bytes
0[1+$11-][$."
"]#
Explanation:
0 {push 0}
{conditional function}
[
1+ {add 1}
$11- {check if 11}
]
{loop function}
[
$. {print number}
"
" {print line break}
]
# {while loop (run second function while first returns true)}
Kotlin: 30?/31/49 bytes
Variable of function type: 30 bytes
val a={(1..10).map(::println)}
This might be considered cheating.
Invokable via a() like the later function. Functions are first-class citizens in Kotlin, so they can be assigned to variables aswell. The type of ´val a´ is technically () -> List<Unit>, a function that takes nothing and returns a "list of nothing", but we wouldn't be on code golf using a language that doesn't have implicit types, would we? 😊
Function: 31 bytes
fun a(){(1..10).map(::println)}
Executable: 49 bytes
fun main(a:Array<String>){(1..10).map(::println)}
Pyth, 4 2 bytes
Well, I guess I think more about legitimate functionality/usability, but this is Code Golf, where usability comes after functionality.
-2 by not formatting my output.
ST
Explanation:
S 1-indexed range from 1 - ...
T Ten
Pyth, 4 bytes
VSTN
Explanation:
V For...
ST in the 1-indexed range from 1 - 10 (T)
N Print the current item
Or alternatively...
VThN
Explanation:
V For...
T In range from 0 - 9
hN Print (the current item + 1)
Pretty simple.
Cubically, 16 bytes
(*1+1/1%@LUL'B)8
(*1+1/1%@LUL'B)8
( do..while loop
*1+1/1 add 1 to notepad
% print notepad as integer
@ output notepad as ASCII (delimiters)
LUL'B algorithm with period 10
)8 loop while cube unsolved
Output (? denotes an unprintable):
1?2?3?4?5?6?7?8?9 10
Bitwise, 208 191 175 bytes
-17 bytes using the registers 3 and 4 instead of function frame registers
-16 bytes using position-based jumps instead of LABELs
.A:
AND $1 $2 3
XOR $1 $2 $1
SL 3 &1 $2
JMP &-4 $2
RET $1
.G:
NOT $1 3
A $2 3 4
A 4 &1 4
SR 4 &31 4
AND 4 &1 4
RET 4
.L:
G $2 $1 3
RET 3
A 1 &1 1
OUTI 1 &1
L 1 &10 2
JMP &-4 2
Explanation:
.A: # subroutine: arg3 = arg1 + arg2
.G: # subroutine: arg3 = arg1 > arg2
.L: # subroutine: arg3 = arg1 < arg2
A 1 &1 1 # add l1 (literal 1) to r1 (register 1)
OUTI 1 &1 -1 # output r1 as integer
L 1 &10 2 # set r2 to r1 < 10
JMP &-4 2 # jump 3 lines back in the code if r2 is nonzero
Output:
1 2 3 4 5 6 7 8 9 10
Implicit, 10 bytes
(;.@%<10)&
( do..while loop
; pop (nothing initially, n<10 after that)
. increment (0 initially, n after that)
@ output ASCII value of n for delimiter
% output n as integer
<10 push n<10
) loop while top of stack truthy (n<10)
& exit (no implicit output)
Output (? denotes an unprintable):
?1?2?3?4?5?6?7?8 9
10
Fortran 95, 32 bytes
It was the only language I know that was not used yet :P
program o
print*,(i,i=1,10)
end
><>, 17 Bytes
1>:nao1\
;\?(b:+/
Pretty basic:
1 | Push 1 to the stack
> | Make sure pointer is going the right direction
:n | Duplicate the number and print it
ao | Print a new line
1\ | Increment, redirect pointer
+/ |-┘
(b: | Check that the result is less than 11
;\? | If it is, continue looping, else end.
T-SQL, 27 bytes
Boring answer.
PRINT'1,2,3,4,5,6,7,8,9,10'
Less boring with a WHILE, 51 bytes
DECLARE @ INT=1WHILE @<11BEGIN PRINT @ SET @+=1 END
AnyDice, 10 bytes
output d10
Try it here.
This program creates and outputs a single 10 sided die. This lists out the numbers on the die (1-10) next to a bar graph of the probabilities in the standard output form.
anyfix, 3 bytes
⁴RK
Note that TIO says that this is 5 bytes but that is because of the unicode character ⁴; in the codepage of anyfix (which is the same as the Jelly codepage), this solution encodes to 3 bytes.
Explanation
⁴ 10
R Range [1..10]
K Join on spaces
Alternatively, ⁴RY separates by newlines. R⁴K and R⁴Y also work because one of the key features of anyfix is that it works with prefix, infix, and postfix (though K and Y will work regardless of what's on the stack because if the top of the stack is not a list or does not exist, then it will use the entire stack as a list). Alternatively, R⁴ or ⁴R and the @l interpreter flag will make it output [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]] because @l makes it output the stack as its string representation in Python.
R, 4 bytes
2:10
The ":" is probably one of the most used R commands. Improvement by Barranka in comments.
Charcoal, 5 bytes
I…·¹χ
Explanation:
I Implicitly print the elements (casted as string) of
…· the inclusive range
¹χ from 1 to 10 (default value of the χ variable)
Carrot, 20 bytes
1 2 3 4 5 6 7 8 9 10
Or if we don't need a separator for 11 bytes:
12345678910
Anything before a ^ in Carrot is placed onto the stack and then that is implicitly output at the end of the program.
With the current version of Carrot this seems to be the shortest way of doing it although I would like to post a none hard coded version if I find one.
Commercial, 649 bytes
A now 1 dollar off!
B now 1 dollar off!
A has been selling out worldwide!
A: made by the makers of B
A has been selling out worldwide!
A: made by the makers of B
A has been selling out worldwide!
A: made by the makers of B
A has been selling out worldwide!
A: made by the makers of B
A has been selling out worldwide!
A: made by the makers of B
A has been selling out worldwide!
A: made by the makers of B
A has been selling out worldwide!
A: made by the makers of B
A has been selling out worldwide!
A: made by the makers of B
A has been selling out worldwide!
A: made by the makers of B
A has been selling out worldwide!
A: made by the makers of B
I tried to do this in a loop, but Jumps in Commercial are weird and I couldn't get it to work properly
MATL, 3 bytes
10:
The code generates the vector [1 2 ... 10] and implicitly displays it, with the numbers separated by spaces.
PHP, 23 bytes
while($i<10)echo++$i,_;
prints a trailing delimiter, run with -nr.
or
<?=join(_,range(1,10));
(already posted by BusinessCat a year ago)
or
for(;$i++<10;)echo$i,_;
(by Ismael Miguel in a comment to BusinessCat´s answer)
21 bytes without the delimiters: while($i<10)echo++$i; or <?=join(range(1,10));
21 bytes with native array output: print_r(range(1,10)); (run with -r)
MY (noncompeting), 3 bytes
Here's the hex:
0A 49 27
Finally, a reasonable solution. Explanation:
0A - Push 10 to the stack
49 - Pop n; Push [1 ... n]
27 - Pop n; Output n
Perl 6, 12 bytes
say @(1..10)
The @() is needed to convert to an array
Alternative solution:
say @(^10+1)
Builds a range [0,10) then adds one, then converts to an array.
Swift 3, 20 bytes
print(Array(1...10))
x86 assembly (32-bit, Linux), 40 bytes
Prints out the numbers from 1 to 10, separated by newlines. The last number is not followed by a newline.
0: 31 db 43 89 d8 b4 0a 50 89 da 42 89 e1 c6 01 30
1: 00 01 50 8d 04 12 cd 80 58 40 3f 73 ee 66 c7 01
2: 31 30 30 e4 cd 80 48 cd 80
Ungolfed:
00000000 <_start>:
0: 31 db xor %ebx,%ebx
2: 43 inc %ebx
3: 89 d8 mov %ebx,%eax
5: b4 0a mov $0xa,%ah
7: 50 push %eax
8: 89 da mov %ebx,%edx
a: 42 inc %edx
0000000b <loop>:
b: 89 e1 mov %esp,%ecx
d: c6 01 30 movb $0x30,(%ecx)
10: 00 01 add %al,(%ecx)
12: 50 push %eax
13: 8d 04 12 lea (%edx,%edx,1),%eax
16: cd 80 int $0x80
18: 58 pop %eax
19: 40 inc %eax
1a: 3f aas
1b: 73 ee jae b <loop>
0000001d <end>:
1d: 66 c7 01 31 30 movw $0x3031,(%ecx)
22: 30 e4 xor %ah,%ah
24: cd 80 int $0x80
26: 48 dec %eax
27: cd 80 int $0x80
The most notable part of the optimization is the aas instruction, which checks if %al is 10 or above, and, if it is, sets the carry flag, and decrements %al by 6. It is meant to be used to adjust for subtraction—you might find the corresponding aaa, which adds 6 instead, used in a real program here. I have instead made use of it because subtracting 6 gets me 4, which is exactly the number I need for another write syscall—saving me another lea instruction.
Python 2.7, 17 bytes
print range(1,11)
Why 11? The range() function is non-inclusive for the end argument.
Firebird, 113 bytes
The compacted select, used to calculate the score is below:
WITH RECURSIVE T AS (SELECT 1 AS I FROM RDB$DATABASE UNION ALL SELECT 1+I FROM T WHERE I < 10 ) SELECT * FROM T
The formated select:
WITH RECURSIVE T AS (
SELECT 1 AS I
FROM RDB$DATABASE
UNION ALL
SELECT 1+I
FROM T
WHERE I < 10
)
SELECT *
FROM T
Short explanation: I start with a select on a system table from firebird, witch always has only one record. Then, using recursion on that projection, I add the column "I" until it reaches 10.
AWK, 26 bytes
BEGIN{for(;i<=9;)print++i}
I don't see an AWK answer, so here we go. I chose to use <=9 rather than <10 just to add a little variety since they have the same byte-count. :)
TI-Basic, 9 bytes
seq(I,I,1,10
TLDCode, 12 10 Bytes
='1'p9{c+}
Clears the stack of the default input, pushes 1 to the stack, parses it from a string to a number, reapeats c+ 9 times, which copies the top of the stack and pushes to the stop of the stack, then incremetnts it. Implicitly prints the stack with _ as the seperator.
Output
1_2_3_4_5_6_7_8_9_10
Previous attempt (12 bytes)
'1'pe9{n+e}=
Pushes 1 to the stack, parses it from a string to a number and prints, then repeats n+e 9 times, which prints a new line, increments the top of the stack and then prints the top. Then it clears the stack to avoid the implicit printing of the default input.
Output
1
2
3
4
5
6
7
8
9
10
8th, 18 bytes
( . cr ) 1 10 loop
><>, 10 bytes
llnao:9=?;
Explanation:
This program pushes the length of the stack instead of trying to increment the top of the stack, because l is shorter than 1+, and you can do it to an empty stack.
l Push the length of the stack. The first time through pushes 0.
ln Print the length of the stack. The first time through prints 1.
ao Print a linefeed. (ASCII value 10)
:9= If the top of the stack is 9 (i.e. we just printed 10), push 1.
Otherwise, push 0.
?; If the top of the stack is non-0, end the program.
Wrap to the start and Repeat. At the end of the loop, we end up
with one more value on the stack than we started with.
Perl, 19 bytes
@x=1..10;print"@x";
The ".." operator can print an ascending list of numbers or letters.
So @x = A..Z; print "@x"; will print capital letters A through Z.
I saved quite a few bytes by removing all spaces.
JavaScript, 14 bytes
_=>12345678910
In the question, it doesn't say anywhere that you must use a delimiter. In fact, it says that I can use any output format that I want, so this answer is valid.
Triangular, 15 bytes
S](l.U@..i/AS%<
Formats into this triangle:
S
] (
l . U
@ . . i
/ A S % <
- The first command,
S, stashes the top of stack (0) in memory. (This is only so that theUwill work the first time.) (opens a loop.Upulls memory onto stack.iincrements the stack value.<directs the IP left, hitting%, which prints the top of stack as an integer.Sstashes the top of stack in memory.Apushes 10 to the stack./directs the IP up-right, hitting@, which prints the top of stack (10) as ASCII (\n).lchecks if the second-to-last stack value (the counter value) is less than 10.- If so, jump back to
(. Otherwise, exit the program.
Dyvil, 20 bytes
for(x<-1..10)print x
21 bytes
for x<-1..10{print x}
Two ways to do the same thing: for-each loop over the range 1..10 with type-inferred loop variable x. The loop body calls the built-in print(int) function with the argument x.
22 bytes
print{for x<-1..10{x}}
This version calls the built-in print(AutoPrinter.()->void) method. An AutoPrinter instance is implicitly available to the {for ...} block, which is passed as an anonymous function. The AutoPrinter class has an applyStatement(any) method, which is called when an expression like x appears in a statement context. The implementation forwards to print(any), which prints the expression.
24 bytes
(1..10).forEach(print _)
Functional approach; creates an IntRange object and calls its forEach(int -> void) (higher order) method. The argument is an anonymous lambda function that passes the argument to the aforementioned print(int) method. In this case, print _ is syntactic sugar for the lambda expression x => print x. Again, the types are inferred by the compiler, so that it internally becomes (int x) => print x.
Output in all cases:
1
2
3
4
5
6
7
8
9
10
Microscript, 7 bytes
10c1p]h
Microscript II, 10 bytes
0s{1+Ps}s10*
Python 3: 24 bytes
print(list(range(1,11)))
Simply print a list of the range.
Outputs:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Python 3 (REPL): 17 Bytes
list(range(1,11))
Outputs a list of ints!
[1,2,3,4,5,6,7,8,9,10]
Q/KDB+ 8 Bytes
1+til 10
Explanation:
til 10
Outputs list of numbers 0 to 9
1+
Increments each number in the list by one
Output:1 2 3 4 5 6 7 8 9 10
Minecraft 26
say "1 2 3 4 5 6 7 8 9 10"
I know there is no special clue in it but I don't know.
Real answer:
scoreboard objective add a dummy
Repeating
give @p wool
stats entity @p set AffectedItems a @p
scoreboard player set @p a 0
clear @p wool 0 0
tellraw @p {"selector":"@p","objective":"a"}
Batch: 36 bytes
for /l %%i in (1,1,10) do (echo %%i)
Breakdown:
for: for operation in batch. Similar to C.
/l: option for the above command
%%i: define %%i, or %i in CMD, just like how you would define i in a for loop in C
in (1,1,10): pretty much "in (start, step, increment)", or in C " for (start, increment, step)".
do: well, run the code after this each time %%i is between 1-10.
(echo %%i): print %%i which is going from 1 to 10
SmileBASIC, 19 bytes
FOR I=1TO 10?I
NEXT
Nothing to see here
QBIC, 9 bytes
[1|10:?a]
Explanation
[ ] FOR <x> = ...NEXT; note that <x> becomes the symbol a-z, based on availability
1|10 <x> goes from 1 to 10, an increment could be specified with ||
: End of FOR-loop specification
?a Print the value of a
EDIT: A non-competing entry saves me one byte two bytes:
[q|z:?a
QBIC now supports variable params for FOR, and q through z are initialised in QBIC to represent 1-10, so saved a byte on the 10. Woohoo! Also, QBIC now detects any unclosed language constructs (IF/DO/FOR) at the end of a program and auto-closes 'm.
EDIT2: QBIC now has a variable number of parameters for its FOR loops. It by default assumes a loop from 1 to 10. Providing 1 parameter (y) makes it run from 1 to y, Providing 2 parameters (x and y) loops from x to y. Providing 3 parameters changes the interval: FOR a = x TO y STEP z. Using the defaults gives us this 4-byter:
[|?a
VIM, using Bash and coreutils: 9 bytes
:!seq 10
Brainfuck, 59 Bytes
+++++[>++++++++++>++<<-]>-<+++++++++[>.+>.<<-]>---------.-.
Brainf***, 57 Bytes
++++[>++++<-]>[>++>+++>+++<<<-]+++++++++[>>+.<.<-]>>>+.-.
This is my first attempt at a program in this language. I think it's pretty optomized
Vim, 9 keystrokes
I saw that there was already a vim answer, but it's not the shortest, so I thought I'd post the shortest one for completeness sake.
10O0<esc>v{g<C-a>
This only works in vim 8, or later versions of vim 7.4.
Explanation:
10 " Ten times:
O " Open a newline
0<esc> " And insert a 0
v{ " Visually select everything
g<C-a> " And create an increasing sequence
MATLAB, 4 Bytes
1:10
Output:
1 2 3 4 5 6 7 8 9 10
The colon operator acts as a range function in Matlab, working from the preceding number to second one, with a default step of 1. (1:3) returns [1,2,3]
As for printing, MatLab Auto prints any line not terminated with a semicolon; Printing a line actually saves space!
Befunge-98, 9 bytes
1+:.:9`kq
Shortened from 11 thanks to a suggestion from ais523.
A step by step description:
1 push 1 to stack.
+ pop top two stack items and add them. push result.
popping an empty stack returns 0, which is why
this works the first loop around.
: dup top.
. print top of stack as integer.
Funge-98 standard states that integer printing
puts a space afterward automatically.
: dup top.
9 push 9.
` pop two items, first b then a.
push 1 if a > b, else 0.
k execute next char n times.
n is top of stack.
if n is 0, the next char is just skipped.
q quit.
This program loops because Funge-98 lines wrap around.
Old Versions
11 bytes
1+:.:a\`!kq
Japt, 3 bytes
1oB
This is very simple: o creates a semi-inclusive range between two values, and B is pre-defined to 11. Thus, this creates the range [1..11), or [1,2,3,4,5,6,7,8,9,10], which is automatically sent to STDOUT.
APL with any ⎕IO, 9 bytes.
1-⎕IO-⍳10
APL with ⎕IO=0, 5 bytes.
1+⍳10
TrumpScript, 45 bytes
Say "1 2 3 4 5 6 7 8 9 10"!
America is great.
Don't even try using a loop... it's much much longer.
Edit: to clarify, TrumpScript uses only numbers greater than 1,000,000, so counting from 1 to 10 would require a lot of variables.
DARTMOUTH BASIC,42 BYTES
EH, WHY NOT?
1 FOR I=1 TO 10
2 PRINT I
3 NEXT I
4 END
Lithp, 64 bytes
((import "lists")(def f #::((each (seq 1 10) #N::((print N))))))
Fairly simple, but unfortunately fairly verbose. I'm counting the import because modules don't automatically load (ie, each and seq are from the lists module, and need to be imported manually.)
To use:
(
(import "lists")(def f #::((each (seq 1 10) #N::((print N)))))
(f)
)
Alternate Answer, 68 bytes, recursive and no modules
(def x #::((def y #N::((print N)(if (< N 10) ((y (+ N 1))))))(y 1)))
Defines a recursive function y which calls itself until N is 10.
I've made this a little more readable here:
(
(def x #::(
(def y #N::(
(print N)
(if (< N 10) (
(y (+ N 1))
))
))
(y 1)
))
(x)
)
Sadly my language is a bit verbose, but Lisp-like language tend to do that. I'm more interested in ensuring the language can handle everything I'd want to throw at it.
Java 7, 50 bytes
void m{for(int i=1;i<11;System.out.println(i++));}
><> (Fish) 10 bytes
1l:naoa=?;
This is my first submission and I know their is already a Fish answer but I don't have the reputation to comment.
The main difference is using the l to place the length of the stack onto the stack allowing us to bypass 'adding one' saving a byte.
Using l also means we don't need to preserve the stack value (just the length) so we do not need to duplicate the top of the stack to preserve our values, saving another 2 bytes (one for the duplication of the stack value and another as we do not need to skip any instructions for preserving the stack).
k, 5 bytes
1+!10
Explanation:
1+ //Projection of +, add 1 to the argument
!10 // "til" 10 - i.e. generate a list of numbers from 0 to n-1
Output:
1 2 3 4 5 6 7 8 9 10
APL, 3 bytes
⍳10
Explanation:
⍳ range
10 10
Vim, 12 bytes
i1<Esc>qqYp<C-a>q8@q
Outputs
1
2
3
4
5
6
7
8
9
10
Explanation:
i1<Esc>qqYp<C-a>q8@qZZ
qqYp<C-a>q -- Macro q: duplicate line and increment (6)
i1<Esc> -- Insert 1 (3)
8@q -- Run macro q 8 times (3)
Tested on Neovim 0.1.4, which to my knowledge is keystroke-compatible with Vim.
Hexagony, 31 bytes
<8!~\\\..)\M\~={{'$;$@.......9$
Still feeling that there are too many no-ops. Had a 34 bytes first draft:
<{."@;.)!.8.{{..M.\\.\'.$(...0=..1
Expanded 31 bytes solution
< 8 ! ~
\ \ \ . .
) \ M \ ~ =
{ { ' $ ; $ @
. . . . . .
. 9 $ . .
. . . .
As in the first draft, uses a < to deflect the IP to NW direction.
This trick is found to be quite useful (for me) when the ending path is short enough after a loop.
Instead of using 10, I used 9 and negate it so the loop is still running 10 times (-9 -8 ... 0 all to the "Left" branch).
Although I managed to increase the number of no-ops in the main loop (NW), I can't modify the main loop due to positioning concerns... Maybe easier to golf off more bytes without using the negation trick.
And though I very much like re-using ops, this time I left a lot of no-ops and used a lot of $ skip commands to keep the loop running.
Oh I really love this language!
GNU sed, 22 21 bytes
c1 2 3 4 5 6 7 8 9 10
With coreutils, the code is only 7 bytes long!
eseq 10
Adding to the diversity of languages used so far, I present a sed solution. The consensus is that sed is exempt from the "no input" rule, since the script doesn't start without.
Run:
echo | sed -f script.sed
Seriously/Actually, 3 bytes
9uR
Try it online: Seriously, Actually
Explanation:
9uR
9u push 9, increment (10)
R range(1, 11) ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
Brainfuck, 41 bytes
+[[-<]>->>->-<-]<<[-<<+<<.+>>>>>.<]<<+.-.
Output
1 2 3 4 5 6 7 8 9 10
Morse code, 65 bytes
.---- ..--- ...-- ....- ..... -.... --... ---.. ----. .----- ----
Copy and paste here to try it out (and listen to the code): http://morsecode.scphillips.com/translator.html
Silicon, 3 bytes
(Silicon uses CP037, so 3 bytes, not 4.)
0Â\
Explanation:
0Â\
\ Push a list with the numbers in the range...
0 Zero
 Ten
Emmet (HTML) - 6 bytes
You'll have to excuse me, I'm new to code golf but I think I understand the concept.
{$}*10
Output:
12345678910
Alternatively, if it's required for the numbers to be seperate, adding a p infront of the braces will put it into <p> tags, like so:
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
<p>10</p>
It also requires a tab to make it "go", I've left that out of the byte count.
Please let me know if I've stuffed up somewhere. Thanks!
Stata, 40 bytes
loc i=1
wh `i'<11 {
di `i'
loc i=`i'+1
}
Output
1
2
3
4
5
6
7
8
9
10
T-SQL, 53 46 Bytes
Saved 7 bytes thanks to @t-clausen.dk
DECLARE @ INT=1z:PRINT @ SET @+=1IF @<11GOTO z
Also 17 bytes (though it feels like cheating):
PRINT 12345678910
HTML, 44 bytes
<ol><li><li><li><li><li><li><li><li><li><li>
This is longer than hardcoding the output, but it is more interesting this way. It creates an ordered list (<ol>) with ten empty list elements (<li>). By default ordered lists are delimited by decimal numbers starting with 1 and a period.
HTML5 is very forgiving regarding unclosed tags, so it closes the li tags implicitly.
Brain-Flak, 30 bytes
((()()()()()){}){(({})[()])}{}
Explanation
For a documentation of what each command does, see the GitHub page.
((()()()()()){}){(({})[()])}{}
((()()()()()){}) push 10
{(({})[()])} while top != 0: pop top, push top, push top-1
{} pop
TI-BASIC, 9 bytes
seq(X,X,1,10
TI-BASIC is tokenized, so seq( is represented as 1 byte, as are all the other characters. The seq function is actually more powerful: the first X is an expression, and the second X is the variable that is used in the expression using the values 1 to 10, instead of using the predefined variable for X. For example, the squares of the numbers from 1 to 10 would be seq(X²,X,1,10.
R, 9 bytes
cat(1:10)
cat prints, 1:10 creates the numbers 1 to 10.
Hexagony, 37 Bytes
Minified:
........./..\..10$\("\.$...).>{<!@.._
Layed Out:
. . . .
. . . . .
/ . . \ . .
1 0 $ \ ( " \
. $ . . . )
. > { < !
@ . . _
Batch, 35 bytes
@for /l %%i in (1,1,10)do @echo %%i
Hardcoding would have saved 10 bytes...
ShadyAsFuck, 10 9 bytes
PPPPPz_G]
This is basically ++++++++++[>+.<-] in BrainFuck and outputs the numerical values as character codes.
C#, 54 bytes
n=>{for(int i=1;i<11;)System.Console.Write(i+++" ");};
K, 5 Bytes
1+!10
1 2 3 4 5 6 7 8 9 10
Explanation;
!2 --> 0 1
!5 --> 0 1 2 3 4
!10 --> 0 1 2 3 4 5 6 7 8 9
1+!10 --> 1 2 3 4 5 6 7 8 9 10
Java 7, 53 51 52 bytes (loop)
void l(){for(int i=0;++i<11;)System.out.println(i);}
Alternative 51 bytes (hardcoded is shorter.., but considered a default loophole, so not allowed):
void h(){System.out.print("1 2 3 4 5 6 7 8 9 10");}
Alternative 54 bytes (recursive):
int i=1;void r(){System.out.println(i);if(i++<10)r();}
Ungolfed & test code for all three:
class Main{
static void h(){
System.out.print("1 2 3 4 5 6 7 8 9 10");
}
static void l(){
for(int i=0; ++i < 11;){
System.out.println(i);
}
}
static int i = 1;
static void r(){
System.out.println(i);
if(i++ < 10){
r();
}
}
public static void main(String[] a){
h();
System.out.println();
l();
System.out.println();
r();
}
}
EDIT: For funsies: As correctly pointed out by @SkippyLeGrandGourou, the base of the 1 to 10 isn't specified in the question, so here is (non-code-golfed) Java code that outputs 1 to 10 in the bases 2 to 10:
BASE-2: 1 10
BASE-3: 1 2 10
BASE-4: 1 2 3 10
BASE-5: 1 2 3 4 10
BASE-6: 1 2 3 4 5 10
BASE-7: 1 2 3 4 5 6 10
BASE-8: 1 2 3 4 5 6 7 10
BASE-9: 1 2 3 4 5 6 7 8 10
BASE-10: 1 2 3 4 5 6 7 8 9 10
Excel 6 bytes
=ROW(
Select the cells A1:A10, type the above (once only) and ctrl-shift-enter as an array formula (which links the cells in an array, with one common formula).
Note the total lack of numerals entered in this process. :-)
𝔼𝕊𝕄𝕚𝕟, 7 bytes
⩤ 1,Ⅹ
Prints out
1,2,3,4,5,6,7,8,9,10
Implicit print, Ⅹ is 10 and ⩤ is range(a, b) so the overall pseudocode is stdout.write(range(1, 10))
Note that, while it is only 5 characters, it still takes up 7 bytes, this is due to the Ⅹ and the ⩤ not being ASCII characters. (Ⅹ is the Roman numeral version)
C++ : 67 bytes
#include<iostream>
int main(int i){for(;i<11;std::cout<<i++<<",");}
1 2 3 4 5 6 7 8 9 10
Python2 - 19 17 bytes
print range(1,11)
Saved 1 byte, thanks to KevinLau - not Kenny!
Output: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Clojure, 20 bytes
(print (range 1 11))
Output:
(1 2 3 4 5 6 7 8 9 10)
JavaScript, 31 bytes
for(i=1;i<11;i++)console.log(i)
Just a for loop that prints the number on every execution. The range of the for loop is 1 to 10.
MoonScript, 17 characters
(Rewrite of Katenkyo's Lua answer. Appreciations should be expressed by upvoting the original answer.)
for i=1,10print i
Sample run:
bash-4.3$ moon <(echo 'for i=1,10print i')
1
2
3
4
5
6
7
8
9
10
CoffeeScript, 19 characters
console.log [1..10]
Sample run:
bash-4.3$ coffee -e 'console.log [1..10]'
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
Elixir, 18 bytes
for n<-1..10,do: n
Output:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Note: This is using iex, the Elixir REPL.
JavaScript, 30 bytes
for(i=0;i++<10;)console.log(i)
But I still love it that good old for beats all the pretty ES versions:
[...Array(10)].map((_,i)=>console.log(i+1)) 43 Bytes
alert([...Array(10)].map((_,i)=>i+1)) 37 Bytes
alert(Array(10).fill().map((_,i)=>i+1)) 39 Bytes
i=[...Array(11)].keys();i.next();alert([...i]) 46 Bytes
alert([...[...Array(11)].keys()].slice(1)) 42 Bytes
alert([...Array(11).keys()].slice(1)) 37 Bytes
JavaScript (ES6), 29 bytes
alert([...`${1e11/81^14}`]+0)
Outputs 1,2,3,4,5,6,7,8,9,10. Not the shortest answer but I thought it was a fun calculation.
Ruby, 8 bytes
Separated by newlines.
p *1..10
PostScript, 12 bytes
1 1 10{=}for
Output:
1
2
3
4
5
6
7
8
9
10
(Most PostScript interpreters don't actually have a proper stdout, or even a command line, but GhostScript has both and can be used to run this program.)
Brainfuck, 34 bytes
With input checkbox checked.
,.>,-.>++++++++[<<+.>.>-],.-.!1!1
Output
1 2 3 4 5 6 7 8 9 10
JShell (Java 9), 37 36 bytes
for(int i=1;i<11;i++)printf("%d ",i)
Java 9 has a REPL called JShell. You'll need an early access build of Java 9 to run it. Once it's installed, just run jshell, paste, and voilà !
Realized after looking at other solutions that newlines aren't a requirement. Saved 1 byte.
LOLCODE, 67 55 bytes
VISIBLE 1 AN 2 AN 3 AN 4 AN 5 AN 6 AN 7 AN 8 AN 9 AN 10
JavaScript with UnderscoreJS, 20 Bytes
alert(_.range(1,11))
Verbosy 31 Bytes
~0 /0 ~10 /1 :a: ^0 o \0 -1 >-a
Verbosy is a language that I wrote btw. The explanation can be found in README.md.
golflua, 13 characters
(Rewrite of Katenkyo's Lua answer. Appreciations should be expressed by upvoting the original answer.)
~@i=1,10w(i)$
Sample run:
bash-4.3$ golflua -e '~@i=1,10w(i)$'
1
2
3
4
5
6
7
8
9
10
Linux ASM, 52 Bytes
file format elf32-i386
Disassembly of section .text:
08048060 <_start>:
8048060: 31 c9 xor ecx,ecx
8048062: 31 db xor ebx,ebx
8048064: 31 d2 xor edx,edx
8048066: 31 ff xor edi,edi
8048068: 43 inc ebx
8048069: 66 81 c7 20 31 add di,0x3120
804806e: 57 push edi
804806f: 89 e7 mov edi,esp
8048071: 42 inc edx
8048072: 42 inc edx
8048073: 83 c1 0a add ecx,0xa
08048076 <loc_16h>:
8048076: 87 cf xchg edi,ecx
8048078: 31 c0 xor eax,eax
804807a: 83 c0 04 add eax,0x4
804807d: 83 ff 01 cmp edi,0x1
8048080: 75 08 jne 804808a <loc_2ah>
8048082: c7 04 24 20 31 30 ff mov DWORD PTR [esp],0xff303120
8048089: 42 inc edx
0804808a <loc_2ah>:
804808a: cd 80 int 0x80
804808c: 66 ff 41 01 inc WORD PTR [ecx+0x1]
8048090: 87 cf xchg edi,ecx
8048092: e2 e2 loop 8048076 <loc_16h>
Cheddar, 7 bytes
->1|>10
Prett simple. |> is range operator. [0, 10] is:
->|>10
Maple, 10 bytes
seq(1..10)
Output:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
F# 17 bytes
Equal to Haskell !! yuppee.
printf"%A"[1..10]
Output:
[1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
For each number on a separate line, 28 bytes:
Seq.iter(printfn"%d")[1..10]
If you remove the standard output permission, simply [1..10] prints out the numbers in F# interactive.
[1..10];;
> val it : int list = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
Julia 0.2, 11 bytes
print(1:10)
Pretty self explanatory. 1:10 is a range, and print expands it.
LOLCODE, 79 bytes
IM IN YR l UPPIN YR v TIL BOTH SAEM v AN 10
VISIBLE SUM OF v AN 1
IM OUTTA YR l
This code may need some tweaking depending on the compiler you're using. Some want you to add HAI/KTHXBYE, some want you to declare the variable ahead of time. One compiler breaks if your loop name is shorter than two characters, even though the loop name is never used.
BrainFuck, 55 Bytes
+++++++++>-->-[-----<+>]+++++++++[-<.+<.>>]<<[->-<]>.-.
Output:
1 2 3 4 5 6 7 8 9 10
(Indents as seperators)
Try it here:
Befunge-93, 12 bytes
1::.9`#@_1+#
Explanation:
1 Start stack with the number 1
:. Print the number on top of the stack
: 9` Set (number on top of the stack) > 9
# Skip the next character, which would otherwise stop the program
_ Is the number in the top of the stack true (i.e. not 0)?
@ If yes, stop the program
1+ If no, add 1 to the top of the stack
# Skip the next character. Since we're at the edge of the program,
it would wrap to the beginning, so the character being skipped is
the "1" at the left edge. That is, "don't put 1 on the stack again"
Befunge, 14 * 3 - 1 = 41 bytes
0v <
>:1+::.55+-|
@
Quick and dirty befunge '93 solution. I'm sure it could be improved, maybe I'll look into it tomorrow. 41 bytes is the 14 * 3 grid in total, excluding a final newline, there are actually 16 characters in the source.
JS, 75 Bytes
a=[0,1,2,3,4,5,6,7,8,9,10]; for(a[0];a[0]<a.length;a[0]++){alert(a[a[0]]);}
Go, 73 bytes
package main
import "fmt"
func main(){for i:=1;i<11;i++{fmt.Println(i)}}
Element, 13 bytes
10'[1+2:`\
`]
This outputs one number per line with a trailing newline. This can be shorted to 12 bytes if I replace the newline with a letter (like the letter x). It works by creating a FOR loop, which repeatedly increments the top of the stack, duplicates it, and outputs it.
JavaScript (Node.JS 5 / Harmony / ES2015), 19 bytes
[...`123456789`,10]
Output
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
Try it here or run node -p -e "[...'123456789',10]"
(For older versions of Node.js, like LTS 4.4.7, use node --harmony)
Racket, 12 bytes
(range 1 11)
Prints '(1 2 3 4 5 6 7 8 9 10).
JavaScript (using external library) (39 bytes)
x=>console.log(_.Range(1,10).Write(""))
Link to lib:https://github.com/mvegh1/Enumerable/
Explanation of code: _.Range creates the array [1,..10], Write joins the array into a string, console.log puts to StdOut
Scala, 14 bytes
print(1 to 10)
output
Range(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
Excel VBA, 47 Bytes
Sub t()
For i = 1 To 10: MsgBox i: Next
End Sub
Lua, 26 bytes
for i=1,10 do print(i) end
Prints them in seperate lines.
Swift 3 (Jun 20, 2016), 20 bytes
print(Array(1...10))
Just doing print(1...10) (un)surprisingly prints 1...10 to STDOUT, so we need to unwrap the Range object into an Array. A Set would be shorter, but does not guarantee order (and in practice doesn't, either).
Racket, 15 bytes
(cdr(range 11))
Racket's interpreters implicitly print return values of expressions to standard output, which is nice.
ListSharp, 37 bytes
[FOREACH NUMB IN 1 TO 10 AS i]
SHOW=i
Pretty straight forward
as a sidenote => is this cheating?
SHOW="10,9,8,7,6,5,4,3,2,1"
Sesos (binary), 5 bytes
Hexdump:
0000000: 2c4bbc 3301 ,K.3.
How it works
The binary file above has been generated by assembling the following SASM code.
Sesos is a language "based on brainfuck", but is "concise, can be typed easily, has somewhat flexible I/O, and is safe for work".
set numout ;sets the output to printing a number per line,
;instead of characters.
add 10 ;now the tape is [10,0,...]
jmp ;start of loop
;sets an entry marker and jump to the jnz instruction.
fwd 1 ;forward the data head
add 1 ;add 1 to the cell under data head
put ;output (as number)
rwd 1 ;rewind the data head by 1 cellby 1 cell
sub 1 ;subtract 1 from the cell under data head
;the tape goes from [0,10] to [1,9], to [2,8]
;to ... [8,2] to [9,1] to [10,0] and then halts.
;(implicit jnz) end of loop, goto "jmp" if not zero
In brainfuck: ++++++++++[>+.<-] (assuming decimal output).
Common Lisp, 29 bytes
(dotimes(n 10)(print(+ n 1)))
MATLAB/Octave, 4 bytes
1:10
Simply prints the numbers 1 through 10 as a vector, with spaces separating them (may have newline if your window is not wide enough)
Brainfuck, 66 Bytes
Sadly, Someone found a 58 Bytes solution, but as we both have different way of solving this, I'll post mine anyway.
+++[>+++>++<<-]>>+[>+++++++<-]>[>+>+<<-<+>]<--<[>>>.+<<.<-]>>>>.-.
Output: 1/2/3/4/5/6/7/8/9/10
Here's what the tape looks like at each step, the * shows where the pointer lies.
+++[>+++>++<<-] tape (0*:9:6)cell-2: counter for printing;cell-3: used for ascii-value of 1
>>+[>+++++++<-] tape (0:9:0*:49) 49 is the ascii value of 1
>[>+>+<<-<+>] tape (0:9:49:0*:49:49) duplicate it 3 times
<--< tape (0:9*:47:0:49:49) one will be used as a delimiter "/"
[>>>.+<<.<-] tape (0:0*:47:0:57:49) outputs the numbers 1..9 separated by "/"
>>>>.-. tape (0:0:47:0:49:48) outputs 10
Perl 5.10, 14 13 bytes
Almost the same as Perl 6:
say for 1..10
I could've done something like say"@{[1..10]}" which is the exact same thing as in Perl 6, but it is too long. :p
Each number is outputted on a separate line.
Thanks to manatwork for saving 1 byte!
PHP, 25 23 bytes
Saved 2 bytes thanks to manatwork.
<?=join(_,range(1,10));
Creates an array of [1 .. 10] and echoes the values separated by _s.
PHP, 20 bytes
1 2 3 4 5 6 7 8 9 10
Standard output is implicit outside of PHP tags when reading from a file or standard input.
I'm assuming that an empty separator does not meet the 'arbitrary separator' constraint.
JavaScript, 25 24 bytes
for(i=1;i<11;)alert(i++)
Bubblegum, 17 bytes
00000000: 026f eafc 0f98 211e 5d50 d0aa 25bc 6f2a .o....!.]P..%.o*
00000010: d1 .
Outputs 1 2 3 4 5 6 7 8 9 10. The program is compressed using BB96, whereas other schemes are longer due to compression-format headers.
Atari Basic, 29 Bytes
1 for i=1 to 10
2 ? i
3 next i
CJam, 6 5 bytes
A,:)`
1 byte saved thanks to Luis Mendo
Output: [1 2 3 4 5 6 7 8 9 10]
Explaination:
A, e# Push a list from 0 to 9.
:) e# Increment all values.
` e# Stringify the list.
Julia, 12 bytes
show([1:10])
In Julia, x:y is a range, inclusive. To cast to a list you need to put brackets around it. Otherwise it will just print the literal characters 1:10.
1 byte saved due to @Dennis. Turns out show works the same as print in this case.
PowerShell, 5 bytes
1..10
Creates a dynamic range with the .. operator from 1 to 10, then that array is left on the pipeline. Output is implicit. Default .ToString() method of an array is newline, so this will be newline-separated when run in a clean shell.
Fuzzy Octo Guacamole, 7 bytes
1.25*$:
Multiplies 2*5, takes the range of that and 1, and prints the whole stack.
1.25*$:
1. # Push 1 to the stack and switch stacks
25* # Push 10 to the stack
$ # Push every number in the inclusive range on the top of inactive stack and top of active stack ([1,2,3,4,5,6,7,8,9,10])
: # Print the stack, which is a list containing the numbers.
Brachylog, 6 5 bytes
Saved one byte thanks to @mat
10yb.
Explanation
10y Get the list [0:1:2:3:4:5:6:7:8:9:10]
b. Output is that list minus the first element
Haskell, 17 bytes
main=print[1..10]
Outputs [1,2,3,4,5,6,7,8,9,10].
Pyth, 2 bytes
ST
First time I've used a golfing lang to answer!
Explanation:
S 1-indexed range. [1, 2, ... A].
T Variable. Initialized to 10. (Ten)
Implicitly printed.
Bash, 12 characters
echo {1..10}
Sample run:
bash-4.3$ echo {1..10}
1 2 3 4 5 6 7 8 9 10
Bash + coreutils, 10 characters
(Just trying to be funny and using ': No such file or directory↵ls: cannot access ' as separator.)
ls {1..10}
Sample run:
bash-4.3$ ls {1..10}
ls: cannot access '1': No such file or directory
ls: cannot access '2': No such file or directory
ls: cannot access '3': No such file or directory
ls: cannot access '4': No such file or directory
ls: cannot access '5': No such file or directory
ls: cannot access '6': No such file or directory
ls: cannot access '7': No such file or directory
ls: cannot access '8': No such file or directory
ls: cannot access '9': No such file or directory
ls: cannot access '10': No such file or directory
Bash + coreutils, 6 characters
(Just trying to be boring. Or not just trying…)
seq 10
Sample run:
bash-4.3$ seq 10
1
2
3
4
5
6
7
8
9
10
J, 6 bytes
1+i.10
Output: 1 2 3 4 5 6 7 8 9 10
Explaination:
1+ NB. Add one to...
i.10 NB. A range from 0 to 9.
Bc, 14 characters
while(i++<10)i
Sample run:
bash-4.3$ bc <<< 'while(i++<10)i'
1
2
3
4
5
6
7
8
9
10
Groovy, 11 characters
print 1..10
Sample run:
bash-4.3$ groovy -e 'print 1..10'
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Retina, 13 bytes
I've got two solutions at this byte count, but it doesn't seem optimal:
_10$*
1
$.`_
11$*_
\B
$.`
They both use _ as separators, prefix and suffix.
Mathematica - 13 bytes
Echo@Range@10
Saved 4 bytes thanks to MartinEnder!
Output: >> {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
jq, 12 characters
(11 characters code + 1 character command line option.)
range(1;11)
Sample run:
bash-4.3$ jq -n 'range(1;11)'
1
2
3
4
5
6
7
8
9
10
Actually, 9 Bytes
19`;1+`na
Explanation:
19`;1+`na
1 Push 1 to stack
9 Push 9 to stack
`;1+` Push Function inside ` to stack
; Push top element to stack
1+ Add 1 to top element
n Run function x times (9 times)
a Invert stack
Lua, 25 Bytes
for i=1,10 do print(i)end
><>, 13 bytes
01+:a)?;:nao!
Explanation :
01+:a)?;:nao!
0 push initial value of n on the stack
1+ increments n
: duplicates n on the stack
a push 10 on the stack
) pops n and 10 of the stack, push n>10 on the stack
?; if n>10, stops program execution
:n duplicates n on the stack in order to display it
ao display 10 (x0A, linefeed)
! skips the next instruction, which since ><> loops is the push 0
You can see it in action on the online interpreter.
C, 36 bytes
main(i){while(printf("%d ",i++)<3);}
This works because the loop terminates after the first 2 digit number.
Jelly, 2 bytes
⁵R
Explanation
⁵ Return the fifth command line argument or 10
R Range
Implicit output





