| Bytes | Lang | Time | Link |
|---|---|---|---|
| 030 | JavaScript V8 | 250403T011658Z | Steve Be |
| 045 | Nim | 250402T082129Z | janAkali |
| 033 | JavaScript V8 | 250402T041343Z | Andrew B |
| 027 | Braingolf | 170615T145507Z | Mayube |
| 045 | Plumber | 210613T180347Z | Aaroneou |
| 015 | Perl 5 + p | 200810T201054Z | Dom Hast |
| 015 | Flipbit | 210803T150725Z | Aaroneou |
| 012 | Zsh | 210801T103511Z | pxeger |
| 015 | Dis | 210623T104916Z | user1004 |
| 012 | BrainCrash | 210622T211331Z | user1004 |
| 2820 | JSFuck eh | 210623T145204Z | FZs |
| 021 | Julia 1.0 | 210623T093802Z | MarcMush |
| 021 | Squire commit c82e0e5 | 210622T225649Z | EasyasPi |
| 009 | Pxem | 210615T085420Z | user1004 |
| 009 | Polyglot of purely literal answers | 170125T192324Z | user6213 |
| 009 | Vyxal | 210615T055624Z | Undersla |
| 009 | Knight | 210614T164015Z | EasyasPi |
| 084 | JSFuck JavaScript | 210613T170459Z | habs |
| 012 | Google Sheets | 200810T181233Z | General |
| 012 | naz | 200811T014003Z | sporebal |
| 009 | Runic Enchantments | 191002T134635Z | Draco18s |
| 018 | Zsh | 190326T065255Z | GammaFun |
| 030 | ink | 190327T002207Z | Sara J |
| 084 | INTERCAL | 190326T081655Z | Unrelate |
| 009 | Brachylog | 190326T063148Z | Unrelate |
| 009 | Pyth | 180813T015416Z | u-ndefin |
| 051 | Pascal FPC | 180814T164041Z | AlexRace |
| 012 | Matlab | 180827T232638Z | DimChtz |
| 024 | Pepe | 180809T103812Z | u-ndefin |
| 009 | APL Dyalog Unicode | 180807T183344Z | J. Sall& |
| 009 | R | 180605T154646Z | JayCe |
| 012 | SMBF | 170125T195714Z | mbomb007 |
| 009 | Japt | 180603T113628Z | Bubbler |
| 111 | Java 8 | 180319T144617Z | Kevin Cr |
| 009 | Stax | 180319T144028Z | Weijun Z |
| 1044 | JsFuck | 180319T140240Z | l4m2 |
| 024 | PHP | 170125T225052Z | junkfood |
| nan | 180317T160230Z | Ali ISSA | |
| 027 | PHP | 180317T142628Z | Titus |
| 180 | Turing Machine | 180317T122559Z | SK19 |
| 286 | LOLCODE | 180317T003804Z | SK19 |
| 021 | Perl 5 | 180317T013548Z | Xcali |
| 024 | Attache | 180317T013202Z | Conor O& |
| 015 | Ly | 180316T222442Z | weatherm |
| 027 | SQL Server | 170418T174535Z | Khaled.K |
| 021 | Carrot | 170615T151909Z | TheLetha |
| nan | Aceto | 170615T151719Z | L3viatha |
| 021 | Triangular | 170615T144357Z | MD XF |
| 057 | C | 170418T172632Z | Khaled.K |
| 021 | REXX | 170419T093154Z | idrougge |
| 021 | Octave | 170419T081453Z | Stewie G |
| 027 | Python 27 Characters | 170418T180617Z | Neil |
| 087 | Python 3 | 170418T171347Z | osuka_ |
| 012 | Cubix | 170418T024432Z | MickyT |
| 018 | BrainFlak | 170125T191905Z | Wheat Wi |
| 012 | VBA | 170328T014024Z | Taylor R |
| 012 | brainfuck | 170327T220307Z | Bijan |
| 111 | C | 170126T102346Z | dim |
| 009 | Bash + coreutils | 170125T221611Z | Mitchell |
| 030 | Chip | 170125T205901Z | Phlarx |
| 024 | tcl | 170128T023150Z | sergiol |
| 009 | Hexagony | 170129T084259Z | Sunny Pu |
| 030 | JavaScript ES6 | 170127T004223Z | apsiller |
| 009 | 05AB1E | 170126T150434Z | Magic Oc |
| 012 | Labyrinth | 170126T150251Z | SnoringF |
| 066 | C | 170126T103902Z | Giacomo |
| 102 | C# | 170125T194220Z | Dmihawk |
| 012 | Ruby | 170125T205326Z | undur_go |
| 021 | Bash | 170126T161841Z | user2428 |
| 009 | Japt | 170126T162709Z | ETHprodu |
| 123 | VBA | 170126T123730Z | Carl Col |
| 015 | 99 | 170126T121612Z | Jonathan |
| 012 | GNU Sed | 170125T200503Z | zeppelin |
| 009 | Jelly | 170126T095736Z | Jonathan |
| 009 | dc | 170125T194334Z | Mitchell |
| 009 | MATL | 170125T203919Z | Suever |
| 009 | Befunge 93 | 170126T013329Z | MercyBea |
| 030 | Python 2 | 170125T200044Z | mbomb007 |
| 009 | Batch ~ | 170125T223723Z | Offtkp |
| 009 | SmileBASIC | 170125T214205Z | 12Me21 |
| 012 | Retina | 170125T222209Z | Martin E |
| 021 | Del|m|t | 170125T205133Z | MercyBea |
| 012 | Ouroboros | 170125T211719Z | DLosc |
| 009 | V | 170125T211110Z | DJMcMayh |
| 015 | Perl 6 | 170125T203027Z | smls |
| 021 | Batch | 170125T204101Z | Neil |
| 033 | JavaScript | 170125T200353Z | ETHprodu |
| 015 | Del|m|t | 170125T205517Z | MercyBea |
| 027 | Retina | 170125T204051Z | mbomb007 |
| 009 | Pip | 170125T204009Z | DLosc |
| 009 | PKod | 170125T194659Z | Offtkp |
| 024 | stacked | 170125T201633Z | Conor O& |
| 021 | Forth | 170125T194754Z | mbomb007 |
| 009 | V | 170125T195516Z | user4180 |
| 033 | PHP | 170125T191853Z | Business |
| 009 | CJam | 170125T190435Z | Business |
| 009 | Microscript II | 170125T190424Z | SuperJed |
JavaScript (V8), 30 bytes
alert`:-):-):-)`///alertalert`
JavaScript (V8), 33 bytes
alert`:-):-):-)`|`rattle`||`earl`
This one doesn't use comments, as suggested.
JavaScript (SpiderMonkey), 39 bytes
If we're not counting the trailing line feed
console.log`111222333`///ccnnsslee..gg`
JavaScript (SpiderMonkey), 42 bytes
If we are counting the final line feed (and therefore need to triple it). There's a trailing linefeed in the source too.
console.log`111222333
`///ccnnsslee..gg`
JavaScript (SpiderMonkey), 48 bytes
console.log(12);console.log(21);console.log(12);
or, painfully the same length:
l=console?.log;s=l(12)?.n;snecg=l(21)?.gec;l(12)
Counting the implicit linefeed as a character.
I've seen people use print() which seems to work like console.log in TIO, but not in actual browser environments.
Nim, 45 bytes
Boring solution:
for i in 1..3:echo"""fforrinn11.33::eecchh"""
Output (with trailing newline):
fforrinn11.33::eecchh
fforrinn11.33::eecchh
fforrinn11.33::eecchh
Nim, 48 bytes
Less boring solution:
writefile "wwrritteffll"&",[]$$&&", $[@"[@@, ]"]
- writes output to file
wwrritteffll,[]$$&&in same directory:
[@['[', '@', '@', ',', ' ', ']']]
Explanation:
writefile # writefile <filename>, <data>
"wwrritteffll" & ",[]$$&&", # `&` - concatenation
$[ @"[@@, ]" ] # `@""` - converts string to array of chars
# `$[]` - array to human-readable string
JavaScript (V8), 33 bytes
print(((print,print,3*3,888**3)))
Inspired by Jonathan Allan's Jelly answer.
The output is:
700227072
Braingolf, 27 bytes
20111[!_!_!_+]2200++[][];;;
It's a cheap method, but only one I can find that works in braingolf.
Explanation
20111[!_!_!_+]2200++[][];;;
20111 Pushes 2, 0, 1, 1 and 1 to the stack
[.......] While loop, runs 3 times..
!_!_!_ ..Prints the last item on the stack 3 times without popping
+ ..Pops and sums the last 2 items, pushing the result
2200 Pushes 2, 2, 0 and 0 to the stack
++ Sums 0 and 0, then 0 and 2
[] While loop, runs 4 times, does nothing
[] While loop, runs 3 times, does nothing
;;; Suppress implicit output (then do it 2 more times)
Plumber, 45 bytes
]][]
==[[=]=]]
[]][ [[=][
[[=][[[=
=]][[=
The ]] and == at the beginning of the first two lines do nothing except lower the number of spaces and increase the number of those characters, and there are two trailing newlines to bring the total up to 6. This outputs the numbers 111000222.
Characters:
- 15
[ - 12
] - 9
= - 6
\n - 3
Zsh, 12 bytes
yes yes yes
Note the trailing space. Outputs yes yes with a newline, repeated infinitely, so all the characters arguably appear a multiple of 3 times.
More boring and definitely allowed:
Zsh, 15 bytes
<<<AAA<<<BB<<<B
Outputs with a trailing newline:
AAA
BB
B
And if we could have a trailing newline without needing it thrice, we could just have <<<aaabbbccc.
JSFuck (eh, plain JavaScript), 2820 bytes
(+[[]])+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]](([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[+[]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+[!+[]+!+[]+!+[]]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+(+[![]]+[])+[+[]]+(+[![]]+[])+[+[]]+(+[![]]+[])+[+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+([+[]]+![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[!+[]+!+[]+[+[]]])())
Probably not the most optimal JavaScript solution (but I doubt anyone will try to optimize it).
Prints:
NaN0NaN0NaN0
The program contains:
(: 159): 159!: 339+: 651[: 756]: 756
Fun fact:
The program (as an expression) evaluates to NaN. (When executing as a full program, it is discarded, so it isn't part of the output.)
Julia 1.0, 21 bytes
@show @show @show 111
output:
111 = 111
#= /home/runner/.code.tio:1 =# @show(111) = 111
#= /home/runner/.code.tio:1 =# @show(#= /home/runner/.code.tio:1 =# @show(111)) = 111
inspired by EasyasPi's answer
Squire commit c82e0e5, 21 bytes
dump(dump(dump(III)))
Squire hath provideth a strange builtin called dump, which releases some forbidden knowledge about what it was called with, then rewards the value itself.
Outputeth:
Number(3)
Number(3)
Number(3)
Pxem, 9 bytes (filename).
~~~.n.n.n
Output:
126126126
How it works
- Three tildes are not commands; each of they are literals.
- Each literal means to push its own codepoint as an integer.
.npops one item and output it as a decimal integer (if any).
Polyglot of purely literal answers, 9 bytes
333111222
This is a community wiki post for collecting answers that are just a literal that the language in question prints out automatically. Because it's a community wiki, feel free to edit it to add more languages where it works.
This program works in:
- PHP
- HTML (arguably not a language)
- Jelly (and M)
- 7 (more interesting, because the program's interpreted as both data and code; the first
3prints the data, the rest of the program is useless stack manpulation) - CJam
- Japt
- Carrot
- R (the R display also outputs [1] as metadata)
- RProgN
- Actually (though it actually prints
2\n2\n2\n1\n1\n1\n3\n3\n3\n) - ///
- Noodel
- TI-Basic
- SimpleTemplate
- ReRegex
- Husk
- Resource (although this outputs the string reversed)
cat
Ignoring the final newline, this is valid in quite a few more languages:
- 05AB1E
- 2sable
- GolfScript
- PowerShell
- m4 (any version, the program is portable)
- Pyth
- MATL
- Pip
- Stax
- Ink
- Keg
- Vyxal
Most links go to Try It Online!
Vyxal, 9 bytes
+₇S₇S₇S++
This is not fully in the spirit of the challenge (because it repeats the output), but it the code itself doesn't repeat which is nice.
Mini-explanation:
₇S computes "128", so ₇S₇S₇S pushes three strings to the stack
+ is concat, so ++ at the end concats all three together, while the beginning one is ignored
Knight, 9 bytes
O!O!O!000
Output: 3x 't', 3x 'r', 3x 'u', 3x 'e', 3x newline
true
true
true
Basically this abuses the fact that the result of OUTPUT is NULL, and ! returns true.
Expanded (which also counts for the 333 rule:
OUTPUT(!OUTPUT(!OUTPUT(!000)))
Basically:
!000 -> true
OUTPUT true -> null
!null -> true
OUTPUT true -> null
!null -> true
OUTPUT true -> null
Note that 000 is just an overlong constant for 0, and !0 is also true.
JSFuck (JavaScript), 84 bytes
!![]+!![]+[!![]+!![]]+(!![]+!![])+(+!![])+(+!![])+(+!![])+(+[])+(+[])+(+[])+(([[]]))
first we take the 3 shortest chars to express in jsfuck:
0: +[] (3 chars)
1: +!![] (5 chars)
2: !![]+!![] (9 chars)
combining them to get "222111000" we get this (75 chars) (this requires putting the second char in an array but then after that we can just add the other characters with the + operator):
!![]+!![]+[!![]+!![]]+(!![]+!![])+(+!![])+(+!![])+(+!![])+(+[])+(+[])+(+[])
this has these charcounts:
[ & ]: 13
( & ): 7
!: 18
+: 17
we can increase our +, (), and [] counts just enough by adding an arithmetic 0 to the end (+(([[]]))).
Google Sheets, 12
+++111222333 outputs 111222333.
Tricks Used:
The leading + gets auto-corrected to an =.
Runic Enchantments, 9 bytes
aaa333@@@
Explanation
Pushes 10 three times, pushes 3 three times, then prints and terminates. The extra two @ serve no purpose beyond complying with challenge requirements. "3*@" would comply with output rules (and is the shortest program that can), but does not comply with source rules.
Zsh, 18 bytes
<<<$_
<<<$_
<<<$_
Also valid: $- with default options, and sometimes $$.
Zsh 36 33 30 27 bytes
This solution produces an acyclic output:
echo {e,h,o}{,{}} eho\\cc\
echo {e,h,o}{,{}} eho\\cc\
{e,h,o}{,{}} # expands to e h o e{} h{} o{}
eho # eho
\\c # '\c' stops printing
The output contains 3 e, 3 h, 3 o, 3 {, 3 {, and 6 <space>.
Try it online!
Try it online!
Try it online!
Comments on 33 byte solution:
-3 bytes by using ) as the end of the range (still divisible by 3)
<<<${(F):-{F..)}{F..)}$-$-((::..}
${ :- } # empty string fallback
{F..)} # The range {F..)} has 30 elements...
{F..)}{F..)} # so {F..)}{{F..)} has 900 elements
$-$-((::.. # Leftover junk, added to each of the 900 elements
${(F) } # Join by newlines
<<< # Print to stdout
If trailing newlines are allowed, then <<<aabbccabc is a 12 byte solution.
ink, 30 bytes
-(i)>:{(-3):{(3)}}
{3>i:->i}
Outputs
>:3
>:3
>:3
and a trailing newline. The output was actually mostly unintentional.
Explanation
-(i) Labelled gather - we can read how many times we've visited this part by looking at the variable i. We can also divert to here.
>: Print the characters > and :
{(-3): If negative 3 is nonzero...
{(3)}} ...print the value of the number 3
Having at least one linebreak makes ink print a newline.
(we have three)
{3>i: If we've passed (i) fewer than three times...
->i} ...jump to (i)
Boring alternative, 9 bytes
11
21
22
Outputs
11
21
22
and a trailing newline. As long as there are four lines, exactly three of which contain one or more characters, you can move and replace the characters (almost) however you want.
Explanation
We just print non-space characters as we encounter them, and print a newline whenever we encounter some number of linebreaks (and/or the end of the program)
No printing literal characters at all, 39 bytes
-(i){3:{-3}}{0:{(0)}}{0}<><>{(i<3):->i}
Outputs -30-30-30 with no trailing newline. This is basically the opposite of how you're supposed to use ink.
Explanation
-(i) Labelled gather - we can read how many times we've visited this part by looking at the variable i. We can also divert to here.
{3: If 3 is nonzero (it is)
{-3}} Print -3
{0: If 0 is nonzero (is isn't)
{(0)}} ...print 0 (we won't)
{0} Print 0 (we *will*)
<><> This is glue. It suppresses newlines.
{(i<3): If we've passed (i) fewer than 3 times...
->i} ...divert to (i)
INTERCAL, 84 bytes
PLEASE.4<-#4DOREADOUT.4DOREADOUT.4DOREADOUT.4DOGIVEUPPLEASELEAS..4<<--##DDOOUUGGIIVV
Ignores the second encouragement and essentially ignores the third (since unreachable syntax errors are pretty much comments), because I'm not feeling quite insane enough today to work around them in INTERCAL. Prints
IV
IV
IV
(6 spaces, 6 newlines, 3 Is, 3 Vs), transparently just three instances of the Roman numeral 4 which could actually just as well have been any other number since spaces get printed above them taking care of the third unique character. Had to be printed three times because number output brings two newlines along with it. Attempting to just print a third newline alone makes it a bit longer...
INTERCAL, 99 bytes
DO,1<-#1DO,1SUB#1<-#176DOREADOUT,1DO.3<-#3PLEASEREADOUT.3PLEASEGIVEUPDOOODD##UUBB7766REEAAT.LGGIIVV
Prints
III
(3 spaces, 3 newlines, 3 Is). Uses both numeric output and C-INTERCAL-style array output. Exactly as long as a version using just array output:
INTERCAL, 99 bytes
DO,9<-#9DO,9SUB#1<-#41DO,9SUB#4<-#77DO,9SUB#7<-#14PLEASEREADOUT,9PLEASEGIVEUPDO,<<--##SULRRTTGGIIVV
Prints
ëëëQQQ>>>
(no spaces or newlines for once). This is the approach which feels most clever to me, as it turns an obstructive feature of array output into a tool: when trying to output a value from an array, what it actually outputs is the previous value minus the value mod 256 with its bits read backwards. This makes it rather difficult to print any particular value, but means that if we want to print a string of repeating characters, we don't need to actually set the corresponding elements of the array, because arrays initialize their elements to zero, and the difference between two identical codepoints is also zero. So this only sets the first, fourth, and seventh elements of ,9, and hypothetically it could even get away with not setting the first one but I'm not sure that null bytes are valid characters.
INTERCAL, 87 bytes
DO,9<-#9DO,9SUB#4<-#7DO,9SUB#7<-#9DOREADOUT,9PLEASEGIVEUPPLEASEDO,,#SSUUB447RRTTLGGIIVV
If they are, then this version here still loses to the first one by 3 bytes, and prints this unprintable mess: 00 00 00 9F 9F 9F 0F 0F 0F.
Brachylog, 9 bytes
000gggwww
Prints [[[0]]]00. Exploits (unnecessarily, it turns out) the fact that, in the absence of constraints on a variable, its value is taken to be zero, and the w predicate which prints the value of its input variable without a newline places no constraints on its output variable. (In fact, if this was allowed to have only two unique characters, gggwww would produce the same output, and gwgwgw or wgwggw would also work.)
w Print
000 zero
g enclosed in a list
g enclosed in a list
g enclosed in a list,
w and print something with no supplied value,
w and print something with no supplied value.
Various permutations of this program work, and are more visually novel than the one presented here, but it's the first version I came up with and to my mind very much to the point. Some permutations include 0gw0gw0gw which violates the second encouragement, w0gw00ggw which has a nice escalating effect, ggwgww000 which shows that the zeros being there really doesn't matter (it may as well be ggwgww777), and nothing containing the substring g0 since no matter what is on the left of the g 0 cannot possibly be a list containing it as its only element so the program will either fail or infinitely spew garbage as it tries to backtrack around the problem depending on whether or not there was a w earlier.
Less trivial variations on the same theme include 3ggw3gw3w, XgggwXwwX, w≡g≡wg≡gw, and w?gw?ggw? (which is actually compliant even with input!) I expected not to find a 9-byte solution and was pleasantly surprised to find a whole family of them.
Pyth, 9 bytes
GGG\L\L\L
Outputs:
abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz L L L
(Note the trailing newline)
Explanation:
GGG\L\L\L - full program.
GGG - output the entire alphabet 3 times, and a trailing newline
\L\L\L - output L 3 times, and a trailing newline
Pascal (FPC), 51 bytes
begin write('ABCABCABC')end.bbggin wwrrtt(())dd..'
Boring one, please see below.
Pascal (FPC), 78 75 72 bytes
var f:int32;begin for f:=22to 33do write(' (())..:;;==abbdggvvww')end.a'
Output:
(())..:;;==abbdggvvww (())..:;;==abbdggvvww (())..:;;==abbdggvvww (())..:;;==abbdggvvww (())..:;;==abbdggvvww (())..:;;==abbdggvvww (())..:;;==abbdggvvww (())..:;;==abbdggvvww (())..:;;==abbdggvvww (())..:;;==abbdggvvww (())..:;;==abbdggvvww (())..:;;==abbdggvvww
(One string 12 times)
Based on 75-byte solution. I managed to remove 3 's by placing 1 from the string after end.. After parsing end., FPC parses 1 more token, then ignores the rest. ' alone after end. causes an error due to not closing the sting literal with another ', so I used one a from the string as a dummy token.
75-byte solution:
Breakthrough solution
var f:int32;begin for f:=22to 33do write(' ''(())''..:;;==aabbdggvvww')end.
Output:
'(())'..:;;==aabbdggvvww '(())'..:;;==aabbdggvvww '(())'..:;;==aabbdggvvww '(())'..:;;==aabbdggvvww '(())'..:;;==aabbdggvvww '(())'..:;;==aabbdggvvww '(())'..:;;==aabbdggvvww '(())'..:;;==aabbdggvvww '(())'..:;;==aabbdggvvww '(())'..:;;==aabbdggvvww '(())'..:;;==aabbdggvvww '(())'..:;;==aabbdggvvww
(One string 12 times)
78-byte solutions:
var f:word;begin for f:=2to 22do write(' ''(())''..:;;==aabbgginoorrtvvw')end.
Output:
'(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw '(())'..:;;==aabbgginoorrtvvw
(one string 21 times)
or
var f:byte;begin for f:=2to 22do write(' ''(())''..:;;==aabdeegginvvwwyy')end.
Output:
'(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy '(())'..:;;==aabdeegginvvwwyy
(one string 21 times)
or
var f:char;begin for f:='a'to'c'do write(' (())..:;;==bbcdgghhinrrtvvww')end.
Output:
(())..:;;==bbcdgghhinrrtvvww (())..:;;==bbcdgghhinrrtvvww (())..:;;==bbcdgghhinrrtvvww
That v in var really starts to annoy me...
Pepe, 24 bytes
rEeEEeeEEErreEErreEEreEE
Program contains 6 r's, 6 e's, and 12 E's.
Explanation:
rEeEEeeEEErreEErreEEreEE # full program
rEeEEeeEEE # push '103' to the stack
rreEErreEE # output as int (r flag: preserve)
reEE # output as int
Output:
103103103
APL (Dyalog Unicode), 9 bytes
,⎕A,⎕A,⎕A
This prints the alphabet, 3 times.
Also works for the digits 0-9:
,⎕D,⎕D,⎕D
R, 9 bytes
c ;c ;c ;
Outputs
function (...) .Primitive("c") function (...) .Primitive("c") function (...) .Primitive("c")
This is a boring solution, still working on a more creative one.
SMBF, 18 15 12 bytes
This program prints its source code backwards. The first loop [[..]] and last < could be removed if it weren't for the source-restriction.
[[..]]<[.<]<
Output:
<]<.[<]]..[[
Proof of Optimality:
Since the output requires at least nine characters (3 unique, 3 each), the program either needs nine prints . plus 3x2 other instructions to meet the source-restriction (this means 15 bytes), or the code uses a loop.
If it uses a loop, the characters necessary are []., three of each. Of course, a movement instruction < or > is necessary to avoid an infinite loop, meaning that a valid solution will be at least 12 bytes.
Japt, 9 bytes
`í`²²²í`í
Outputs
''sseerreerreerr'sererer'sererer'sererer'sererer'sererer'sererer'sererer
which contains each char of 'sererer 9 times.
I found this by accident while experimenting with Japt, and wanted to share this which IMO is much more interesting than a number literal polyglot and a solution that has three dummy bytes and simply prints something three times, even though those are also 9 bytes.
How it works
`í`²²²í`í
`í` Shoco-compressed string of "'sererer"
² Repeat 2 times
² Repeat 2 times
² Repeat 2 times
í Interleave with ... into a string
`í Shoco-compressed string of "'sererer"
Japt uses shoco library for string compression, which excels at compressing sequences of lowercase letters. It's actually surprising that one byte can decompress into an 8-char string.
Java 8, 153 150 144 138 135 120 117 111 bytes
class Sbccddggmossuvvyy{public static void main(String... a){{};;System.out.print(",,,".replace(",", ",ab"));}}
-27 bytes thanks to @ØrjanJohansen.
Prints ,ab,ab,ab.
Code used to verify the occurrences of the characters are multiplies of 3, which is a modified version of my answer for a different challenge.
Explanation of the basic golfed program (72 bytes):
interface M{ // Class
static void main(String[]a){ // Mandatory main-method
System.out.print(",ab,ab,ab");}} // Print ",ab,ab,ab"
Things I (and @ØrjanJohansen) did to create multiples of 3:
- Changed
interfacetoclass(and addedpublicbeforestatic). - Changed class-name to
Sbccddggmossuvvyy - Changed
String[]atoString... a - Added unused no-op
{}-block - Added two no-op
; - Changed
",ab,ab,ab"to",,,".replace(",", ",ab")
Stax, 9 bytes
..3.3**3*
The output may not be what one would expect. Hope this is more interesting. Still output the same string repeated thrice, though.
Explanation
..3 Two character literal. ASCII: [46, 51]
.3* Two character literal, "3*"
* Interlace, [46, "3*", 51]
3* Repeat 3 times
Implicit output
JsFuck, 1044 Bytes
[!!(([[]]))][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+[+[]]]+(![]+[])[+!![]]+(![]+[])[!![]+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]])()(+(+!![]+[!![]+!![]]+(+[])+(+!![])+(!![]+!![])+(+[])+(+!![])+(!![]+!![])+(+[])))
Bad one
PHP, 24 bytes
<?=111?><?=222?><?=333?>
SHELL
to joke :) ( 9 Bytes )
ls;ls;ls;
or more seriously ( 24 Bytes )
sed s/./sed.g./g <<< edg
Result :
sed.g.sed.g.sed.g.
PHP, 27 bytes
<?=$s=";\<?=\",\<?;",$s,$s;
prints ;\<?=",\<?; three times
<?=$s="\<<?=\",\>>",$s,$s?>
prints \<<?=",\>> three times
<?=$s=";<?,<?=;","$s","$s";
prints ;<?,<?=; three times
Run with -n or try them online.
TiO includes checks and two variants of a 30 byte solution.
Turing Machine, 180 bytes
name: z
init: init
accept: accept
init,_
a1,0,>
a1,_
a2,0,>
a2,_
b0,0,>
b0,_
b1,1,>
b1,_
b2,1,>
b2,_
c0,1,>
c0,_
c1,2,>
c1,_
c2,2,>
c2,_
accept,2,>
name,3
name,3,-
za0,3
za0,-,-
Note the trailing new line. You can paste the source code into here. The machine takes 3*3=9 steps by simply going right and outputting 000111222 (the infinite blank symbols _ to the left and right are not counted). The last two states are unused states to have the source code fulfill the requirements. The used alphabet is _0123-, which is also dividable by 3 :-)
LOLCODE, 273 240 (360 286) bytes
HAI 1.2
I HAS A U
IM IN YR M UPPIN YR Q TIL BOTH SAEM Q 1
VISIBLE "Y SUB.EK"
IM OUTTA YR M
IM IN YR T UPPIN YR Q TIL BOTH SAEM Q 2
VISIBLE "Y SUB.EK"
IM OUTTA YR T
IM IN YR X UPPIN YR Q TIL BOTH SAEM Q 12
VISIBLE "IM"
IM OUTTA YR X
KTHXBYE
Note the trailing new line and try it online. The second line was more or less arbitrary and can possibly replaced by a shorter command, but I just learned LOLCODE for this puzzle. Since the version number is required in the first line, I used the numbers to add loops of length 1, 2 and 0 mod 3 to ensure the right number of characters will be printed. From this I simply counted each character (with this tool). If it appeared 0 mod 3 times, no action was required. If it appeared 1 mod 3 times, it was added to the 1- and 2-loop so it would appear three times in the output. If it appeared 2 mod 3 times, the character was added to the 12-loop. EDIT: By replacing the first VISIBLE with an assignment (still useless but required to have 12 instead of 11 new lines), I was able to cut off 33 bytes.
Output (60 byte):
Y SUB.EK
Y SUB.EK
Y SUB.EK
IM
IM
IM
IM
IM
IM
IM
IM
IM
IM
IM
IM
Note the trailing new line.
Nice thing about this solution in comparison to the other answers is that the Output can easily manipulated to output somewhat meaningful text. Example (286 bytes with trailing new line):
HAI 1.2
I HAS A U
IM IN YR MW UPPIN YR Q TIL BOTH SAEM Q 1
VISIBLE "YO SUB. EEEEK!"
IM OUTTA YR MW
IM IN YR STA UPPIN YR Q TIL BOTH SAEM Q 2
VISIBLE "YO SUB. EEEEK!"
IM OUTTA YR STA
IM IN YR XURG UPPIN YR Q TIL BOTH SAEM Q 12
VISIBLE "IMO U R SWAG! "
IM OUTTA YR XURG
KTHXBYE
Try it online. Output (222 bytes with trailing new line):
YO SUB. EEEEK!
YO SUB. EEEEK!
YO SUB. EEEEK!
IMO U R SWAG!
IMO U R SWAG!
IMO U R SWAG!
IMO U R SWAG!
IMO U R SWAG!
IMO U R SWAG!
IMO U R SWAG!
IMO U R SWAG!
IMO U R SWAG!
IMO U R SWAG!
IMO U R SWAG!
IMO U R SWAG!
Sadly, I'm not as good with anagrams as I thought :')
Attache, 24 bytes
Print!73Print!73Print!73
The output is (with a trailing newline):
73
73
73
For bonus "encouragement" points:
Attache, 30 bytes
"PPrriinntt""""||**33"*3|Print
This is just:
"PPrriinntt""""||**33"*3|Print
" " a string ("" is an escaped double quote)
*3 repeated 3 times
|Print then print that string
SQL Server, PostgreSQL, SQLite, 27 bytes
SELECT 111222333 SSELLCCTT
Oracle SQL, MySQL, 46 bytes
SELECT 111222333 SSELCCTTFFRROOMMDDUUAAL FROM DUAL
Output
111222333
Carrot, 21 bytes
aaa^*2^bbb^*2^ccc^*2^
Outputs:
aaaaaaaaabbbaaaaaaaaabbbaaaaaaaaabbbcccaaaaaaaaabbbaaaaaaaaabbbaaaaaaaaabbbcccaaaaaaaaabbbaaaaaaaaabbbaaaaaaaaabbbccc
Which is a 117 byte long string containing 81 as, 27 bs and 9 cs.
This also works for 9 bytes but it isn't as fun:
aaabbbccc
Aceto, 18+1=19 bytes
Requires the use of the command-line switch -l
"aaabbbccc"\p\p\"p
Prints, unsurprisingly, aaabbbccc.
Triangular, 21 bytes
3>\..3...(;...d/dp]%<
Formats into this triangle:
3
> \
. . 3
. . . (
; . . . d
/ d p ] % <
Prints 210210210. (2, 1 and 0 each printed 3 times.)
The program with only conrol flow:
.
> \
. . .
. . . .
. . . . .
/ . . . . <
The above is a nice loop we can fit the code into. To achieve the desired output we simply want to print 210 three times. So we push 3 to the stack (the number of times we want to print it) and then 3 after a directional (3 decrements to 2, then to 1, then to 0).
The first directional \ pushes 3 to the stack, then puts the code into this loop: (d%]. That loop first decrements the top of stack, then prints it, then jumps back if the vale is nonzero.
The next part looks like this: pd; which pops the ToS (to get rid of the 0), decrements the new ToS (which was the 3 we pushed at the start), exit if the ToS is <= 0, then uses directionals to get back into the initial loop.
C, 57 bytes
main(){printf("^^-_-^-__","");("{{pprrmmaainttff,,}}");;}
Output
^^-_-^-__
Alternative Version, 56 bytes
main(){printf("%1$d%1$d%1$d","({{pprrmmaainttff,,}})");}
REXX, 21 bytes
say 10
say 10
say 10
Outputs three 10s and three newlines.
I can think of funnier output, but since this is code golf, this is what you get.
Octave, 21 bytes
'ans==ans '%%%ans= '
ans = ans==ans
Creates a string: 'ans==ans ', that's automatically printed (since ; is omitted), with ans = in front of it.
Python 27 Characters
print"\\\"printprint**"*333
The output and code comply with the rules. All characters occur 3 times in the code, as you can probably see. Since I'm multiplying by multiply of 3 the output will always be divisible by 3.
Python 3, 87 bytes
AET=' TEE'
exec("""print('A TE');exec('print("A AT");exec("print(AET)")')""")
AET=="";
I wasn't going for the shortest solution - I just really, really wanted to abuse exec.
It can probably be made shorter, though I don't remember the last time I've had this much fun golfing python. Great challenge!
Cubix, 12 bytes
A bit of a boring answer really. Outputs three 10s followed by newlines
N@N@NOoOoOo@
Try it online! Maps to the cube
N @
N @
N O o O o O o @
. . . . . . . .
. .
. .
N Pushs 10 to the stack
Oo x3 Outputs 10 and newline
@ halts the program
The initial N@N@ is not hit.
Brain-Flak, Flakcats, Brain-Flueue, Brain-Flak Classic, Miniflak, and Fλak 18 bytes
Proven optimal!
((([()][()][()])))
Explanation
Brain-Flak, Brain-Flueue, Miniflak, and Fλak
([()][()][()]) Push -3
( ) Copy
( ) Copy
This prints:
-3
-3
-3
(There is a trailing newline)
Brain-Flak Classic
Brain-Flak Classic is the original version of Brain-Flak and has some important differences from modern Brain-Flak. In BFC [...] prints its contents rather than negating it.
[()] Print 1
[()] Print 1
[()] Print 1
( ) Push 3
( ) Push 3
( ) Push 3
At the end of executing the contents of the stack (3 3 3) is printed.
This prints:
1
1
1
3
3
3
(There is a trailing newline)
Flakcats
Flakcats is quite different from the other 4 flaks and I am surprised that this works in Flakcats. The three operators here are nearly the same as the ones that Brain-Flak uses.
The main difference in this particular program between Flakcats is the (...) operator which in Flakcats is equivalent to ([{}]...) in Brain-Flak. This however does not make a difference to us because it picks up zeros and thus operates much in the same way that Brain-Flak does.
Here is that program compiled into Brian-Flak:
([{}]([{}]([{}][()][()][()])))
This prints:
-3
-3
-3
(There is a trailing newline)
Proof of Optimality in Brain-Flak and Miniflak
This is not a formal proof, but rather an informal proof that would have to be expanded to be made more rigorous
Because of the restrictions that Brain-Flak programs must be a balanced-string and the program length must be a multiple of 3 any valid submission must be a multiple of 6 in length. This means any solution smaller than 18 must be length 12.
Because of the outputs trailing newline the final height of the stack must be a multiple of three or we will break the restrictions on output.
Any valid submission of length 12 must have 2 types of braces (having less would break the restrictions on number of distinct characters and more would mean more than 12 characters). Since the program produces output it must have a push.
This leaves us to select our other set of braces. The options are:
<...>/<>
This fails because we need to generate "value" in order to create any number other than zero we must give up a () to create a one which makes it impossible to push more than two times.
[...]/[]
This fails for the same reason the last failed. The square braces are really bad at making value. The [] monad can create value but we need to push numbers first and we then don't have enough parens left over to push three times.
{...}/{}
This one is promising, we could create a loop and use one () to push multiple times, but alas it is not possible.
In order for the loop to end there must be a zero on the stack at some point and in order for us to have the correct output we must have something other than zero on the stack at the end of the program. Since we have neither [] nor <> the zero at the end of the loop must be a implicit zero from the bottom of the stack. This means the loop cannot add any new numbers to the stack making it useless.
Since none of the brace choices can create a program of length 12 none can exist.
Since Miniflak is a subset of Brain-Flak any shorter Miniflak program would also be a shorter Brain-Flak program and thus does not exist.
Proof of Optimality in Brain-Flueue
Brain-Flueue is a joke language based off of Brain-Flak. The two are so similar their interpreters are identical everywhere but two lines. The difference between the two is, as their names suggests, Brain-Flueue stores its data in queues while Brain-Flak stores its data in stacks.
To start we have the same restrictions on program size created by Brain-Flak, thus we are looking for a program of size 12. In addition we are going to need a (...) in order to create any output and another pair. the <> and [] pairs do not work in Brain-Flueue for the exact same reason they do not work in Brain-Flak.
Now we know that our program must consist of the characters ((())){{{}}}.
Via the same methods used in the previous proof we can demonstrate that there must be a loop in the final program.
Now here is where the proofs differ, because Brain-Flueue operates across queues rather than stacks the program can exit a loop with values on the queue.
In order to exit the loop we will need a zero in the queue (or an empty queue but if the queue is empty we get the same problem as Brain-Flak) this will mean that we will have to open our program with ({}) to create the zero. We will need a push inside of the loop to push the necessary number of items to the queue. We will also need to push a non zero number before the loop so that we can enter the loop at all; this will cost us at absolute minimum (()). We have now used more parens than we have.
Thus there is no Brain-Flueue program to do the task that is 12 bytes, and furthermore there our program is optimal.
Optimal solution in Flakcats and Brain-Flak Classic
The following solution is optimal in Flakcats and Brain-Flak Classic.
((([][][])))
Explanation
[][][] -3
((( ))) push 3 times
Alternative 24 byte Brain-Flak solutions
(<((<((<(())>)())>)())>)
((<((<((<>)())>)())>)())
((((((()()()){}){}){})))
VBA, 12 Bytes
Anonymous VBE immediates window function that takes no input and outputs to the VBE immediates window.
?75:?75:?75:
Output
75
75
75
brainfuck, 12 bytes
++[+...][][]
Nobody said the output had to be short. This will output 3 copies of every ascii character except the first 2.
You can prove that this is as short as it will get. You need to output therefore you need 3 '.' there need to be different outputs therefore you need 3 [+-] now we're up to 6. 9 characters have to be printed, which means either adding 6 more '.' or adding a loop, which will add another 6 characters.
C, 111 bytes
(Note how the byte count is also the three same numbers. Wow. You can't do more meta than that.)
#include<stdio.h>
#define b "<acdhlmoprsu>."
#define t "en"
main(){{{printf(("<acdhlmoprsu>." b b t t t));;;}}}
Prints:
<acdhlmoprsu>.<acdhlmoprsu>.<acdhlmoprsu>.enenen
Bash + coreutils, 15 9 bytes
id;id;id;
Sample Output:
uid=1000 gid=1000 groups=1000 context=system_u:unconfined_r:sandbox_t:s0-s0:c19,c100,c173,c211
uid=1000 gid=1000 groups=1000 context=system_u:unconfined_r:sandbox_t:s0-s0:c19,c100,c173,c211
uid=1000 gid=1000 groups=1000 context=system_u:unconfined_r:sandbox_t:s0-s0:c19,c100,c173,c211
(If you try this out, it will print your uid, gid, etc., 3 times.)
If you want to avoid repeating the same string 3 times (and also have the same output for everybody, unlike my first answer), the best I've found for bash + Unix utilities is 15 bytes long:
dc<<<cczdzfzfdf
Try this second version online!
Output:
2
0
0
3
2
0
0
3
3
2
0
0
(No newlines in the program, 12 newlines in the output.)
Explanation of the dc program in this answer:
c Clears the stack.
Stack: (empty)
c Clears the stack.
Stack: (empty)
z Pushes the current size of the stack (0) onto the stack.
Stack: (top) 0
d Duplicates the item at the top of the stack.
Stack: (top) 0 0
z Pushes the current size of the stack (2) onto the stack.
Stack: (top) 2 0 0
f Prints the stack, top to bottom, with a newline after each item printed (this prints the first 3 lines of the output, 2 / 0 / 0 /)
z Pushes the current size of the stack (3) onto the stack.
Stack: (top) 3 2 0 0
f Prints the stack, top to bottom, with a newline after each item printed (this prints the next 4 lines of the output, 3 / 2 / 0 / 0 /)
d Duplicates the item at the top of the stack.
Stack: (top) 3 3 2 0 0
f Prints the stack, top to bottom, with a newline after each item printed (this prints the final 5 lines of the output, 3 / 3 / 2 / 0 / 0 /)
Chip, 30 bytes
**ZZZZZZZZZT
*gggaaabbbTT
Output:
@@@AAACCC
(score includes 3 total newlines, and 3 bytes for -w on the command line)
Chip is a new language I've been designing, and this is it's first real test drive! It's a 2D bit-based language that functions somewhat like an integrated circuit you might put together with a breadboard.
This solution outputs three @'s (binary 01000000), three A's (01000001), then three C's (01000011) by turning the bits successively on.
Breakdown
Ungolfed (or, really, without the excess parts):
*ZZZZZZZZZ
g a b T
* is a source element which produces a high signal; that is sent to
g , which represents the bit 0x40 of the output stream, and
Z , which propagates signal after one clock tick. After 3 ticks (for three Z elements),
a receives a high signal, and now the 0x1 bit is also on. Three ticks later,
b turns on the 0x2 bit, and three ticks again activates
T , which terminates execution.
All other added elements are active (e.g. not a comment), but they don't do anything, similar to assigning a variable to itself.
tcl, 24
puts 12
puts 12
puts 12
In the code, there is an Enter at the bottom, which the site ate.
Output: the output consists of 12Enter12Enter12Enter
Hexagony, 9 bytes
x!!xx@@!@
Print out 120120120. x can be replaced by f-m (102-109)
Explanation
x ! !
x x @ @
! @ . . .
The xx@@ is only a filler to comply with the rules. The main flow is saving x into the memory (with ASCII value 120) and then print it as a number 3 times.
JavaScript (ES6), 30 bytes
+alert((({alert}+{alert}+{})))
Outputs [object Object][object Object][object Object].
Works by creating three objects:
the first two are of the form
{ "alert" : alert }using ES6 notation{alert}the third is a simple empty object
Then it uses + to concatenate them together, and all three have an identical expression as a string, [object Object].
The leading + is useless, only present to fill out the number of + characters, but is harmless to the output of the program.
05AB1E, 9 bytes (I guess you could say this was a piece of PI)
-0 bytes thanks to Emigna/ETHProductions, made the solution more correct.
žqžqžq???
Alternate versions:
ž[g-Q]ž[g-Q]ž[g-Q]???
[g-Q] - Can put any letter a-Q here, as long as they all match (see below).
Explained:
PI,PI,PI,SORT,JOIN,SORT,JOIN,SORT,JOIN.
Result:
...111111222333333333444555555555666777888999999999
The reason it is only 9 bytes is because you don't need the sorts, I just put them in to help illustrate.
Result w/o { in the code:
3.1415926535897933.1415926535897933.141592653589793
Alternative Renditions:
The following commands can be used in place of PI:
ž 23 > žg push current year
žh push [0-9]
ži push [a-zA-Z]
žj push [a-zA-Z0-9_]
žk push [z-aZ-A]
žl push [z-aZ-A9-0_]
žm push [9-0]
žn push [A-Za-z]
žo push [Z-Az-a]
žp push [Z-A]
žq push pi
žr push e
žu push ()<>[]{}
žy push 128
žz push 256
žA push 512
žB push 1024
žC push 2048
žD push 4096
žE push 8192
žF push 16384
žG push 32768
žH push 65536
žI push 2147483648
žJ push 4294967296
žK push [a-zA-Z0-9]
žL push [z-aZ-A9-0]
žM push aeiou
žN push bcdfghjklmnpqrstvwxyz
žO push aeiouy
žP push bcdfghjklmnpqrstvwxz
žQ push printable ASCII character set (32-128)
Labyrinth, 12 bytes
Program:
!!!(!(!(!@@@
Output:
000-1-1-1
The last two @ aren't technically a comment, but they're just as useless. However, it's kind of inevitable since @'s a necessary character to exit a Labyrinth.
Explanation:
Labyrinth's stack contains an infinite number of 0's at the bottom.
!: pops the top of the stack and prints its decimal representation
(: decrements the top of the stack by 1
@: terminates the program
Because this program is a single line, most of Labyrinth's rules for deciding what direction to go are irrelevant; it just moves down the line from left to right.
C, 66 Bytes
main(i){{for(i=0;i<3;i++){printf("""poop+fart=<3<3at0m=m0n""");}}}
Output
poop+fart=<3<3at0m=m0npoop+fart=<3<3at0m=m0npoop+fart=<3<3at0m=m0n
Old Version 72 Bytes
main(i){for(i=0;i<3;i++){printf("poop+fart=<3<3 at {\"0m=m0\"}" "\n");}}
C#, 114 111 118 102 bytes
If we don't care about using proper words: (102 bytes)
class CCcddiilMMmmnrrSSsttvvWWyy{static void Main(){{System.Console.Write(("A TEA AT TEE"));;;}}}///".
If we care about proper words: (120 bytes)
class erebeWyvern{static void Main(){int embedWildbanana;{System.Console.Write(("A TEA AT TEE"));;}}}///CC Myst mvcSMS".
My original submission - case insensitive: (113 bytes)
class EreBeWyvern{static void Main(){int embedwildbanana; {System.Console.Write(("A TEA AT TEE"));;}}}/// vyt".
I know the comment isn't really in the spirit of the CG, but it's all I could come up with in a limited amount of time, I'll see if I can improve it through the day. Surely I must get at least some bonus points for the nod to being adventurous.
Edit: Thank you to roberto06 for catching the missing letters!
Ruby, 12 bytes
p$@;p$@;p$@;
outputs
nil
nil
nil
To fulfill the second "encouraged" criterion, I need 15 characters:
p 1;p 3;p 1133;
produces
1
3
1133
Bash, 21 bytes
A pure Bash solution that has no external dependencies.
e== ;e=cchhoo;echo $e$e$e;
Testing script
For convenience, I also wrote a test script that counts the number of occurrences of a character in a string. You can use it to validate your own solutions.
o={};
prompt``.split``.forEach(
ch=>o[ch]=o[ch]?o[ch]+1:1
);console.log(o)
Japt, 9 bytes
000OoOoOo
Prints undefinedundefinedundefined. Test it online!
Explanation
This code gets transpiled into the following JavaScript:
000,O.o(O.o(O.o()))
O.o is a function that outputs something without a trailing newline. When given no argument, it prints undefined, which could be considered a bug, but comes in handy here. It also returns undefined, so all three calls prints undefined.
I'm sure there are plenty of other ways to do this...
VBA, 123 bytes
Sub Auto_Open()
god_fx = ("OK" + " X")
For rapid = 1 To 3
MsgBox god_fx, 3 + 1 = rapid, Mid("mk OK X", 3 + 1)
Next
End Sub
It's a sub, but when you paste it in an empty Excel workbook, it'll run when you open the workbook.
Displays a MsgBox with in it 3x the text "OK" and 3x an "X" (the close button looks like an 'X', right?!) It even does this 3 times in a row for good measure :)
There are only 5 line endings in here, but that's because the VBA IDE always appends an empty line, making it 6 again. And since VBA doesn't care about case, I didn't either :P
99, 15 bytes
9 9 9999
9
9
9
That is nine nines, three spaces, and three line feeds, the output is -1110-1110-1110.
How?
9 9 9999 - V(9)=V(9)-V(9999)=1-1111=-1110
9 - print V(9)
9 - print V(9)
9 - print V(9)
The two spaces are treated as one, this third space could be a trailing space on any line too.
GNU Sed, 12 bytes
Golfed
abc
abc
abc
(note the trailing newline)
How It Works
a text
Appending text after a line. This is a GNU extension.
Appends the "bc" string + LF 3 times, resulting in 3 b, 3 c and 3 LF characters in the output.
Test
%echo|sed -n 'abc
abc
abc
'
bc
bc
bc
%echo|sed -n 'abc
abc
abc
'|tr \\n N|fold -1|sort|uniq -c
3 N
3 b
3 c
Jelly, 9 bytes
**‘‘‘888*
A full program which prints 700227072, which is 888 cubed.
How?
**‘‘‘888* - Main link: no arguments
- implicit L=R=0
* - power A = L ^ R = 1
‘ - increment B = L + 1 = 1
* - power C = A ^ B = 1
‘ - increment D = C + 1 = 2
‘ - increment E = D + 1 = 3
888 - literal F = 888
* - power F ^ E = 700227072
dc, 9 bytes
zfzfdzddf
Output:
0
1
0
3
3
3
1
1
0
(The program has no newlines; the output has 9 newlines.)
The new answer above is better than my old answer of the same length, because the new answer meets OP's suggestion that the output ideally shouldn't be the same string repeated 3 times. Here's the old answer, which I'll keep here so that @mbomb007's comment continues to make sense!
_A_A_Annn
Output is
-10-10-10
(no newlines in either the program or the output)
MATL, 12 9 bytes
3 Bytes saved thanks to @Luis
JVvJVvJVv
Outputs:
0 +1i
0 +1i
0 +1i
Explanation
J is the shortcut for the complex number 0 + 1i. We convert this to a string with V and repeat this motif 3 times and concatenate the entire stack vertically three times using v.
Befunge 93, 9 bytes
...,,,@@@
Prints 0 0 0 (Trailing space, followed by 3 null bytes)
Because Befunge's stack is padded with 0s, we can print both the ASCII character with that value, and the integer itself. Because Befunge automatically prints a space after an integer, we are left with 3 distinct characters.
. prints 0 (trailing space), , prints a null byte, and @ ends the program
Python 2, 36 30 bytes
Since a trailing newline isn't allowed, this is probably as short as it can get:
print"\\\""*3;print;print;3**3
Outputs \" three times, followed by three newlines.
The below programs don't count the trailing newline, so they're not valid.
27 bytes:
print"""printprint"""*3*3*3
Prints 54 of each character in print.
Same length, shorter output:
print"""printprint*3*3"""*3
Outputs printprint*3*3printprint*3*3printprint*3*3
24 bytes:
print~9;print~9;print~9;
Batch ~ 9 bytes
bc
bc
bc
Two random chars, followed by a new line, makes 3 chars that are shown 3 times.
Hex dump: 62 63 0A 62 63 0A 62 63 0A
Output:
C:\Users\4story\Desktop>bc
'bc' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\4story\Desktop>bc
'bc' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\4story\Desktop>bc
'bc' is not recognized as an internal or external command,
operable program or batch file.
My environment username happens to be "4story". However, it doesnt matter what directory you are in, or what your username is - output will always fulfill the rules.
SmileBASIC, 9 bytes
?12?21?21
Output:
12
21
21
Not the most exciting thing, but it fulfills all 3 recommendations.
Retina, 18 12 bytes
Byte count assumes ISO 8859-1 encoding.
aaa¶¶ccc
¶
prints
a
a
a
c
c
c
That's 12 linefeeds.
Del|m|t, 21 bytes
; ; ; 8 8 8 8 8 8 555
prints 32 -1 32 -1 32 -1 (with a trailing space)
No command line argument = as delimiter
; pushes -1 followed by the delimiter, and 8 prints the top of the stack. 555 ends the program
Here's another interesting solution with 24 bytes total:
; 0 / / 8 8 8 >>>;;00/
(2 trailing spaces to make it a multiple of 3)
This one just uses the -1, but is longer due to the lack of repetition, so the "end" command had to be pretty long
prints -1 -1 -1 (also a trailing space)
The ; pushes the delimiter (as above), the 0 drops the top, so the stack only has a -1 on it. / / duplicates it twice, and 3 8s print. >>>;;00/ ends the program
Ouroboros, 12 bytes
n11n222n1(((
Outputs 011222 three times. Try it here.
How?
In Ouroboros, each line of code represents a snake swallowing its tail. Execution proceeds from the head (start) of the line to the tail (end), and then loops back to the head. The ( instruction swallows characters from the tail. If the instruction pointer is swallowed, execution halts.
The n command outputs a number. Popping the empty stack gives zero, so the first n prints 0. The next prints 11, and the third prints 222.
Now we come to 1(: push 1 and swallow that many characters. The final paren is swallowed. The next-to-last paren does nothing1, and execution loops back to the beginning.
The second time through, the next-to-last paren is swallowed and we loop again. The third time, the third-to-last paren is swallowed. This swallows the IP, and the program ends.
1 The stack is empty, so it swallows 0 characters.
V, 9 bytes
¬ac¬ac¬ac
This outputs:
ababcabcc
This is pretty straightforward. Each ¬ is the "range operator", that takes two character arguments and inserts each character in that range. So ¬ac inserts abc. Repeating this three times causes some weird issues with the layout of the output (which is why they're not in order) but thankfully this doesn't matter for this particular answer.
Perl 6, 15 bytes
.say;.say;.say;
Prints six distinct characters, three times each:
(Any) (Any) (Any)
How it works
- A bare method call operates on the current topic,
$_. $_starts out as the type object of typeAny, whichsayprints as(Any).
Batch, 36 21 bytes
@echo
@echo
@echo
Outputs
ECHO is on.
ECHO is on.
ECHO is on.
Edit: Saved 15 bytes thanks to @P.Ktinos.
JavaScript, 36 33 bytes
alert(((alert|alert||333111222)))
Alerts 333111222. This works because | converts both of its operands to 32-bit integers, and any value that doesn't look anything like an integer (e.g. the function alert) gets converted to 0. 0|0 is 0, so the || operator returns its right operand, or 333111222
A few more interesting versions:
(a="(trelalert)\\\"")+alert(a+=a+=a)
Outputs (trelalert)\"(trelalert)\"(trelalert)\".
A solution using .repeat would be the same length, thanks to the shared aert:
alert("(trpp.all)\\\"".repeat(3.33))
which outputs (trpp.all)\"(trpp.all)\"(trpp.all)\".
Taking advantage of the extra backslashes to get rid of l and p almost works:
a\x6cert("(trax.cc)\"".re\x70eat(6.00677))
This one outputs (trax.cc)"(trax.cc)"(trax.cc)"(trax.cc)"(trax.cc)"(trax.cc)".
Del|m|t, 15 bytes
8 9 8 9 8 9 555
Prints 0 0 0 (with a trailing space) (there are null bytes after every space, including the trailing one
Because the stack is padded with 0s, we can just print the ASCII value and character, because printing the value also prints a space. 555 ends the program.
Retina, 27 bytes
aaabbb
S\`
S\`
S\`
\`\`\`
The output is 150 bytes, containing 12 a, 12 b, and 126 newlines.
Pip, 9 bytes
PzPzPzuuu
Outputs the lowercase alphabet three times, each time followed by a newline. Try it online!
Explanation
The naive attempt
P12P12P12
actually prints 12 four times. That's because Pip autoprints the result of the last expression in the program. P12 prints 12, but it is also an expression that evaluates to 12. So an extra 12 is printed.
We can avoid this by making the last expression in the program evaluate to nil. When nil is printed, it produces no output--not even a newline. The variable u is preinitialized to nil. Repeating it three times is fine, just adds a couple no-ops.
PKod, 9 bytes
sonsonson
Outputs: 111222333
Explanation:
Background: PKod has only one variable that you mess with, with the code
This variable starts with default value of 0
s - Add next char to the variable, and jump over it.
n - Print numeric value of variable
o has ascii char code "111" in decimal. Thus s adds 111 to the variable, then prints the number. First "son" makes it 111 and prints 111. Next makes it 222 and prints 222, lastly makes it 333 and prints 333
Forth, 21 bytes
1 1 1 . cr . cr . cr
Program contains 3 of each of 1.cr, and 9 spaces. Output contains 3 ones, 3 spaces, and 3 newlines.
Output:
Each 1 has a space after it.
1
1
1
V, 9 bytes
12i12i12i
Outputs 12i 24 times:
12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i
Vim, 12 bytes
12i12i12i<ESC><ESC><ESC>
Outputs the same as the V answer
PHP, 33 bytes
<?=($s="<?;<?=;'".'"').($s).($s);
Opted for something more interesting than the 9-byte program with no PHP tag.
Outputs <?;<?=;'"<?;<?=;'"<?;<?=;'"
CJam, 9 bytes
10,10,10,
Outputs 012345678901234567890123456789
Explanation
10, The range from 0 to 9
10, The range from 0 to 9
10, The range from 0 to 9
Microscript II, 9 bytes
{{{~~~}}}
Explanation: Creates a code block, but doesn't invoke it. When execution ends, the contents of the main register (IE this code block) are implicitly printed.