Three-Three-Three!

66

10

Write a program that produces an output such that:

  1. At least three distinct characters appear.
  2. The number of occurrences of each character is a multiple of 3.

For example, A TEA AT TEE is a valid output since each of the 4 distinct characters, A, E, T and (space), occurs 3 times.

Of course, a challenge about the number 3 needs to have a third requirement. So:

  1. The program itself must also follow the first two requirements. (This means your program will be at least 9 bytes long.)

You must write a full program, not a function. Be sure to show your program's output in your answer.

Also, to keep things interesting, you are highly encouraged:

  • not to use comments to meet requirement 3 if you can help it
  • to produce output that isn't just a string repeated 3 times
  • to make the output different from the program itself (for languages that can automatically output the contents of its own program, you can contribute to this community wiki).

This is . Shortest code in bytes wins.

darrylyeo

Posted 2017-01-25T18:56:36.350

Reputation: 6 214

5Do newlines count (as a distinct character) ? – zeppelin – 2017-01-25T19:05:16.543

4Are programs that consist entirely of literals allowed? (There are a lot of languages where 123123123 will work, as currently written.) – None – 2017-01-25T19:09:01.853

@ais523 Thanks for pointing that out. Since a few such answers have already been posted, I've updated the question to simply discourage them. – darrylyeo – 2017-01-25T19:53:07.937

2@zeppelin Yes, newlines count as a distinct character. – darrylyeo – 2017-01-25T19:58:49.033

Is a trailing newline allowed? – ETHproductions – 2017-01-25T20:13:00.223

@ETHproductions If you need it to satisfy requirement 2, most definitely. – darrylyeo – 2017-01-25T20:17:27.887

2What I mean to ask is, can a program output e.g. abcabcabc with a trailing newline? – ETHproductions – 2017-01-25T20:18:10.530

1@ETHproductions Ah, I see. No, that is not allowed. Three trailing newlines would be acceptable, however. – darrylyeo – 2017-01-25T20:19:14.100

Are Null bytes as one of the 3 characters acceptable? – MildlyMilquetoast – 2017-01-25T20:27:35.383

@Mistah Figgins Yes, any character goes. – darrylyeo – 2017-01-25T20:49:13.493

You know what would make quite an interesting CG? To produce the shortest programs which could verify solutions to this CG – Dmihawk – 2017-01-25T23:31:43.913

I don't think stderr should be allowed, personally. It should be noted that the amount of downvotes on that meta answer shows how controversial it is. Some recent challenge answers have put stderr answers as CW for that reason. – mbomb007 – 2017-01-26T14:42:18.573

The challenge title doesn't meet the criteria, lol – mbomb007 – 2018-03-19T14:11:35.517

Answers

59

Brain-Flak, Flakcats, Brain-Flueue, Brain-Flak Classic, Miniflak, and Fλak 18 bytes

Proven optimal!

((([()][()][()])))

Try it online!

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

(<((<((<(())>)())>)())>)

Try it online!

((<((<((<>)())>)())>)())

Try it online!

((((((()()()){}){}){})))

Try it online!

Post Rock Garf Hunter

Posted 2017-01-25T18:56:36.350

Reputation: 55 382

2+1 for the proof as well. – HyperNeutrino – 2017-01-26T21:35:01.433

3+1 for the polyglot as well, esp. not all outputs are the same. – Shieru Asakoto – 2018-03-17T02:04:01.830

27

Jelly, 9 bytes

**‘‘‘888*

A full program which prints 700227072, which is 888 cubed.

TryItOnline!

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

Jonathan Allan

Posted 2017-01-25T18:56:36.350

Reputation: 67 804

5888^3 is 700227072? That's very clever, perhaps other languages can use this trick. – ETHproductions – 2017-01-26T16:08:28.870

23

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 3 prints 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)

Ignoring the final newline, this is valid in quite a few more languages:

Most links go to Try It Online!

user62131

Posted 2017-01-25T18:56:36.350

Reputation:

3This prints 2\n2\n2\n1\n1\n1\n3\n3\n3\n in Actually, which is perfectly valid. Should that be added to the post? – ETHproductions – 2017-01-25T20:10:09.697

@ETHproductions I actually think Actually should be added to the post since it uses the same code ;) – user41805 – 2017-01-25T20:12:55.407

As the person who made Actually, I agree that it belongs in this post. The newlines don't really make a difference. – Mego – 2017-01-26T03:21:05.860

This also works on the language I've written: SimpleTemplate. It will compile it into an over-kill echo '333111222'; (in PHP) but it works.

– Ismael Miguel – 2017-01-26T18:13:27.400

@IsmaelMiguel: Feel free to edit it into the answer yourself. It's a community wiki, that's how they work. – None – 2017-01-26T18:35:11.943

@ais523 I find that very intrusive. If ETHproductions doesn't find the language minimally interesting or doesn't like me or just having a cold, he doesn't have to have his pristine answer ruined by someone shoehorning his language into the list. – Ismael Miguel – 2017-01-26T19:09:17.827

4

@IsmaelMiguel: This is a community wiki answer; it was only 29% written by ETHproductions (and in fact, it was me who originally created the answer, as you can see from the revision history; ETHproductions has more text in the current version of the answer than anyone else, but definitely isn't responsible for the whole thing). Its entire purpose is to be edited by a large range of users as a collaborative effort. (This is distinct from normal answers, which aren't designed to be edited.)

– None – 2017-01-26T19:11:35.413

21

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!

Dmihawk

Posted 2017-01-25T18:56:36.350

Reputation: 321

1I'm a C++ guy, not C#, but can you not just wrap the Write call in {()} without affecting it? – Sparr – 2017-01-25T20:01:05.683

Thanks for the suggestion! The curly braces work, the parentheses don't – Dmihawk – 2017-01-25T20:09:20.953

1You might be able to put the parentheses around the argument, rather than the call as a whole. – None – 2017-01-25T20:11:12.450

Right you are! It's looking better with every edit! (although not getting any shorter sadly) – Dmihawk – 2017-01-25T20:25:42.420

7Brownie points for the wild banana. – darrylyeo – 2017-01-25T21:07:05.097

I'm confused... The question states, "The number of occurrences of each character is a multiple of 3." I only see 1 newline, 1 S, 4 Es, 1 C, etc. I think it's case sensitive. (S is clearly not s) – MildlyMilquetoast – 2017-01-26T01:38:47.407

@MistahFiggins In fairness to the competition I have revised my submission, but I I have kept the original entry because I'm quite proud of what I managed to come up with in 10mins (plus some help from commenters) – Dmihawk – 2017-01-26T01:47:53.063

6Nice! I like the variable names. +1 – MildlyMilquetoast – 2017-01-26T01:53:42.670

1

You should remove V from your comment, and add vyt, since Vis only present there while v is present twice (typo, I guess), y is also present twice, and t is present 5 times. See here. Nevertheless, awesome job !

– roberto06 – 2017-01-26T08:56:34.987

1"embedWildbanana". I agree with Mistah Figgins. – HyperNeutrino – 2017-01-26T21:33:56.857

18

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)".

ETHproductions

Posted 2017-01-25T18:56:36.350

Reputation: 47 880

1Nice abuse of decimals! – darrylyeo – 2017-01-25T20:46:03.750

2@darrylyeo Heh, thanks. I could've easily stuck those in the string, but that wouldn't be as fun ;-) – ETHproductions – 2017-01-25T20:46:49.557

Thought I'd let you know you were topped by an ES6 answer.

– darrylyeo – 2017-01-28T03:30:41.200

14

CJam, 9 bytes

10,10,10,

Outputs 012345678901234567890123456789

Try it online!

Explanation

10,       The range from 0 to 9
   10,    The range from 0 to 9
      10, The range from 0 to 9

Business Cat

Posted 2017-01-25T18:56:36.350

Reputation: 8 927

doesn't 3,3,3, work for 7 bytes? – chim – 2017-01-26T09:46:56.100

Ah! yeah, the third requirement :) – chim – 2017-01-26T09:48:15.650

Argh, a missed opportunity to use 99,99,99,, because why not? – workoverflow – 2018-03-18T07:58:06.570

@workoverflow Because that doesn't work with the third requirement. The program needs to contain three distinct characters. – DLosc – 2018-03-20T08:41:17.207

@DLosc Touche, I forgot about that! – workoverflow – 2018-03-20T12:21:02.927

11

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.

Try it online!

Bijan

Posted 2017-01-25T18:56:36.350

Reputation: 781

10

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

Try it online

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.

Try it online


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;

mbomb007

Posted 2017-01-25T18:56:36.350

Reputation: 21 944

You could do print"""printprint*3*3"""*3 for a much shorter output ;-) – ETHproductions – 2017-01-25T20:05:59.160

Could you not do print 123;print 123;print 123; for the naive solution? – ETHproductions – 2017-01-25T20:33:19.367

OP has clarified that the single trailing newline is not allowed (see comments). – FlipTack – 2017-01-25T20:36:22.400

1@ETHproductions Sure. It depends how naive we're being. – mbomb007 – 2017-01-25T20:43:33.093

@FlipTack Fixed it, and I feel like I just hit an optimal solution for when the trailing newline isn't forgiven. – mbomb007 – 2017-01-25T20:59:52.343

3Even more naive: print~9;print~9;print~9; – Sp3000 – 2017-01-25T22:35:28.550

9

Perl 6, 15 bytes

.say;.say;.say;

Prints six distinct characters, three times each:

(Any)
(Any)
(Any)

Try it online!

How it works

  • A bare method call operates on the current topic, $_.
  • $_ starts out as the type object of type Any, which say prints as (Any).

smls

Posted 2017-01-25T18:56:36.350

Reputation: 4 352

1

Now I've got a Yeah Yeah Yeahs song stuck in my head.

– Stuart P. Bentley – 2017-01-26T10:45:57.453

9

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");}}

Giacomo Garabello

Posted 2017-01-25T18:56:36.350

Reputation: 1 419

2Not only your code is much smaller than what I did, but it also contains real bits of poop and farts. Bravo. – dim lost faith in SE – 2017-01-26T19:57:02.067

9

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.

apsillers

Posted 2017-01-25T18:56:36.350

Reputation: 3 632

Way to beat the other JS answer! – darrylyeo – 2017-01-28T03:29:01.087

You should also add (ES6) to the title. – darrylyeo – 2017-01-28T03:29:31.997

@darrylyeo Thanks! :) And I added ES6 – apsillers – 2017-01-28T04:12:36.250

8

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

P. Ktinos

Posted 2017-01-25T18:56:36.350

Reputation: 2 742

8

Ruby, 12 bytes

p$@;p$@;p$@;

outputs

nil
nil
nil

Try it online!

To fulfill the second "encouraged" criterion, I need 15 characters:

p 1;p 3;p 1133;

produces

1
3
1133

Try it online too!

undur_gongor

Posted 2017-01-25T18:56:36.350

Reputation: 191

7

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.

SuperJedi224

Posted 2017-01-25T18:56:36.350

Reputation: 11 342

Have you posted something similar in the Quine challenge? – wizzwizz4 – 2017-01-25T19:08:39.713

@wizzwizz4 {} would technically be a quine, but I don't think it meets our definition of a "proper quine". The program "q"q (which I did submit to the quine challenge) does, however. – SuperJedi224 – 2017-01-25T19:09:17.757

@wizzwizz4: That wouldn't be a proper quine, because each character represents itself. – None – 2017-01-25T19:09:58.360

7

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

dim lost faith in SE

Posted 2017-01-25T18:56:36.350

Reputation: 7 018

7

Hexagony, 9 bytes

x!!xx@@!@

Try it online!

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.

Sunny Pun

Posted 2017-01-25T18:56:36.350

Reputation: 821

6

PHP, 33 bytes

<?=($s="<?;<?=;'".'"').($s).($s);

Opted for something more interesting than the 9-byte program with no PHP tag.

Outputs <?;<?=;'"<?;<?=;'"<?;<?=;'"

Try it online!

Business Cat

Posted 2017-01-25T18:56:36.350

Reputation: 8 927

5

Bash + coreutils, 15 9 bytes

id;id;id;

Try it online!

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

Mitchell Spector

Posted 2017-01-25T18:56:36.350

Reputation: 3 392

How does the second one work? – 2xsaiko – 2017-02-01T14:56:10.810

@therealfarfetchd I've added an explanation to the answer. – Mitchell Spector – 2017-02-01T17:39:38.487

Damn, dc is far more powerful than I thought. Nice job! – 2xsaiko – 2017-02-03T15:02:10.780

@therealfarfetchd Thanks. I like dc. Btw, there were a couple of typos in the explanation which I just fixed. – Mitchell Spector – 2017-02-04T00:08:59.267

5

PHP, 24 bytes

<?=111?><?=222?><?=333?>

junkfoodjunkie

Posted 2017-01-25T18:56:36.350

Reputation: 151

1What does this output? How does it work? – James – 2017-01-25T22:59:49.453

It uses the PHP shorttag <? together with the immediate echo statement <?= to output 123 3 times. – junkfoodjunkie – 2018-03-18T04:43:27.657

The shorter version you just edited in is invalid since the <= ?> characters don't appear a multiple of 3 times. – James – 2018-03-18T05:14:32.767

Ah, right, I knew there was a reason for the original version being as it was - I completely flaked on the requirement - I will change it back. – junkfoodjunkie – 2018-03-18T05:17:59.490

5

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.

Try it online!

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.

Jonathan Allan

Posted 2017-01-25T18:56:36.350

Reputation: 67 804

5

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

SK19

Posted 2017-01-25T18:56:36.350

Reputation: 161

1Welcome to the site! – James – 2018-03-17T00:51:02.953

@DJMcMayhem Thanks. Anything I need to do to get LOLCODE such a nice automatic linking as I copied from other posts? (the # [language] style) The link to the source code is contained in the answer. – SK19 – 2018-03-17T00:55:44.273

The easiest way is, when you've put your program in TIO, to use the link menu and select (or copy) the choice for "Code Golf Submission". That gives you a template for a new post. I copied the part you seemed to be missing from there. – Ørjan Johansen – 2018-03-17T01:12:55.437

5

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.

Ali ISSA

Posted 2017-01-25T18:56:36.350

Reputation: 211

4

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.

Neil

Posted 2017-01-25T18:56:36.350

Reputation: 95 035

2

Wouldn't 3 alone echo's work? echo\necho\necho - replace \n with a new line - it looks valid to me http://image.prntscr.com/image/ef96173169eb41168815203387d4975b.png , makes it 14 bytes.

– P. Ktinos – 2017-01-25T20:56:23.857

Outgolfed: http://codegolf.stackexchange.com/a/108180/63033

– P. Ktinos – 2017-01-25T22:37:43.873

4

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

Try it online!

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)

Magic Octopus Urn

Posted 2017-01-25T18:56:36.350

Reputation: 19 422

2Get out for the pun; for the trick though get one :) – geisterfurz007 – 2017-01-26T16:29:01.467

Nice one! I don't think žv, žw, or žx are valid though as they each have only 2 distinct digits. – ETHproductions – 2017-01-26T16:36:27.933

Hmm, what's the point of the backwards character classes? – ETHproductions – 2017-01-26T16:38:32.537

@ETHproductions ahhh, forgot about at least 3, was just PI at first when I wrote it. What do you mean backwards character classes? – Magic Octopus Urn – 2017-01-26T17:08:43.290

Like [z-aZ-A9-0_]. I don't see how that'd be any different than [a-zA-Z0-9_]. – ETHproductions – 2017-01-26T17:38:17.763

1Note that this is only valid if you don't count the newline that's implicitly printed. That could easily be fixed by replacing JJJ with ??? though. – Emigna – 2017-01-27T12:40:50.523

Good call, better to be correct 100% regardless. – Magic Octopus Urn – 2017-01-27T14:09:01.560

@ETHproductions not different, just illustrating the different ways this can be done with built-ins. – Magic Octopus Urn – 2017-01-27T14:17:23.327

No, sorry, I'm just confused about why the backwards char classes are built-ins... – ETHproductions – 2017-01-27T14:50:24.887

@ETHproductions seems very costly to get them otherwise, and they've only used a-Q they still could use R-Z for additional sequences when they need them. žL = žnRžm is an example of cost, prolly was spurred by a challenge. I've used it once before, forget why now. – Magic Octopus Urn – 2017-01-27T15:28:32.373

4

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...

ETHproductions

Posted 2017-01-25T18:56:36.350

Reputation: 47 880

1O_o Interesting :) – geisterfurz007 – 2017-01-26T16:34:07.840

4

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.

MickyT

Posted 2017-01-25T18:56:36.350

Reputation: 11 735

I count 34 spaces :/ – SK19 – 2018-03-16T22:41:50.100

@SK19 The code is N@N@NOoOoOo@ and does not include any spaces. – MickyT – 2018-03-17T02:17:59.370

Ah, okay, I thought the cube needed to fulfill the requirement, too – SK19 – 2018-03-17T10:58:37.497

4

Pepe, 24 bytes

rEeEEeeEEErreEErreEEreEE

Try it online!

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

u_ndefined

Posted 2017-01-25T18:56:36.350

Reputation: 1 253

3

V, 9 bytes

12i12i12i

Try it online!

Outputs 12i 24 times:

12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i12i

Vim, 12 bytes

12i12i12i<ESC><ESC><ESC>

Outputs the same as the V answer

user41805

Posted 2017-01-25T18:56:36.350

Reputation: 16 320

3

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.

[[..]]<[.<]<

Try it online

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.

mbomb007

Posted 2017-01-25T18:56:36.350

Reputation: 21 944

I think you can move two < to the end to drop the w. – Martin Ender – 2017-01-25T20:24:30.230

3

stacked, 24 bytes

''''   'putput'3*3*3*put

Try it online! Outputs 54 each of p u and t.

Conor O'Brien

Posted 2017-01-25T18:56:36.350

Reputation: 36 228

3

Chip, 30 bytes

**ZZZZZZZZZT
*gggaaabbbTT


Output:

@@@AAACCC

Try it online!

(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.

Phlarx

Posted 2017-01-25T18:56:36.350

Reputation: 1 366

Where are the 3 newlines? If you put your code in <pre><code>...</code></pre> in markdown, we'll be able to see them. – mbomb007 – 2017-01-25T21:06:48.910

@mbomb007 End of each line and one more at the end. Did that change anything? I don't see a difference... – Phlarx – 2017-01-25T21:22:47.423

Oh, wow.... there's gray boxes. Apparently the contrast or gamma or something is really screwed up on one of my monitors. – Phlarx – 2017-01-25T21:31:35.923

I had that problem with a monitor a few months back. It fixed itself after a few days. Idk what caused it, but changing settings wouldn't fix it. Also, that final newline is required in the markdown, because the block shows one less due to some SE formatting issue. – mbomb007 – 2017-01-25T21:35:15.020

3

Befunge 93, 9 bytes

...,,,@@@

TIO

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

MildlyMilquetoast

Posted 2017-01-25T18:56:36.350

Reputation: 2 907

3

C, 57 bytes

main(){printf("^^-_-^-__","");("{{pprrmmaainttff,,}}");;}

Output

^^-_-^-__

Alternative Version, 56 bytes

main(){printf("%1$d%1$d%1$d","({{pprrmmaainttff,,}})");}

Khaled.K

Posted 2017-01-25T18:56:36.350

Reputation: 1 435

{ and } appear only once in your code, so I'm afraid this is not a valid answer. – Laikoni – 2017-04-19T08:14:01.673

You also have a non-multiple-of-three number of " – VisualMelon – 2017-04-19T08:28:32.187

@Laikoni added two more of { and }. – Khaled.K – 2017-04-19T09:07:53.850

1@VisualMelon added ,"" to printf – Khaled.K – 2017-04-19T09:08:44.517

You can remove all three commas. – Jakob – 2018-06-04T01:36:51.953

3

R, 9 bytes

c ;c ;c ;

Try it online!

Outputs

function (...) .Primitive("c") function (...) .Primitive("c") function (...) .Primitive("c")

This is a boring solution, still working on a more creative one.

JayCe

Posted 2017-01-25T18:56:36.350

Reputation: 2 655

3

Brachylog, 9 bytes

000gggwww

Try it online!

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.

Unrelated String

Posted 2017-01-25T18:56:36.350

Reputation: 5 300

2

dc, 9 bytes

zfzfdzddf

Try it online!

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

Try the old answer online!

Output is

-10-10-10

(no newlines in either the program or the output)

Mitchell Spector

Posted 2017-01-25T18:56:36.350

Reputation: 3 392

5♫ Barbara _A_A_Annn – mbomb007 – 2017-01-25T21:03:01.167

@mbomb007 LOL!! – Mitchell Spector – 2017-01-25T21:47:29.513

2

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

Try It Online !

zeppelin

Posted 2017-01-25T18:56:36.350

Reputation: 7 884

2The newline only appears twice, I think you can add an extra newline at the end to meet this requirement – user41805 – 2017-01-25T20:05:53.100

2^ What he said. Your source code's length must be divisible by 3. – mbomb007 – 2017-01-25T20:11:00.873

@KritixiLithos, mbomb007 - Thank you ! Should be fixed now ! – zeppelin – 2017-01-25T20:15:38.230

2

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.

DLosc

Posted 2017-01-25T18:56:36.350

Reputation: 21 213

1"...each line of code represents a snake swallowing its tail" (⊙.☉)7 – Luigi – 2017-01-27T01:12:25.060

@Luigi https://en.wikipedia.org/wiki/Ouroboros (but yeah, that is a bit trippy)

– DLosc – 2017-01-27T03:46:51.900

2

Retina, 18 12 bytes

Byte count assumes ISO 8859-1 encoding.


aaa¶¶ccc

¶

prints


a
a
a




c
c
c


That's 12 linefeeds.

Try it online!

Martin Ender

Posted 2017-01-25T18:56:36.350

Reputation: 184 808

2

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)

user2428118

Posted 2017-01-25T18:56:36.350

Reputation: 2 000

Question states "... full program. Not an answer". Off of this I think this is invalid. – geisterfurz007 – 2017-01-26T16:25:47.750

@geisterfurz007 Fixed. – user2428118 – 2017-01-26T16:40:44.823

Looking good I think :) Just noticed that I wrote an answer instead of a function... – geisterfurz007 – 2017-01-26T16:57:56.847

2

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 

Taylor Scott

Posted 2017-01-25T18:56:36.350

Reputation: 6 709

2

SQL Server, PostgreSQL, SQLite, 27 bytes

SELECT  111222333 SSELLCCTT

Oracle SQL, MySQL, 46 bytes

SELECT  111222333 SSELCCTTFFRROOMMDDUUAAL  FROM DUAL

Output

111222333

Khaled.K

Posted 2017-01-25T18:56:36.350

Reputation: 1 435

1The top answer needs an extra E: SELECT 111222333 SSELLCCT makes it 27 bytes (which makes sense, 26 isn't a multiple of 3). – BradC – 2017-06-15T15:05:24.443

Other 27-character solutions exist, like PRINT 123PRINT 123PRINT 123 (for MS SQL), but I think I found one for 24: PRINT 12PRINT 12PRINT 12, since we can count the newline that PRINT produces. – BradC – 2017-06-15T15:10:30.560

2

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.

Neil

Posted 2017-01-25T18:56:36.350

Reputation: 2 417

2

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

TheLethalCoder

Posted 2017-01-25T18:56:36.350

Reputation: 6 930

I see you have an interest in Carrot :D Maybe you can help me decide a potential feature change in chat (don't mind the wrong ping in the message btw :/).

– user41805 – 2017-06-15T16:55:24.007

2

Ly, 15 bytes

'&::'o::'&::o&o

Try it online!

weatherman115

Posted 2017-01-25T18:56:36.350

Reputation: 605

2

Perl 5, 21 bytes

say"\\\"ssaayyxx33"x3

Try it online!

Xcali

Posted 2017-01-25T18:56:36.350

Reputation: 7 671

2

Stax, 9 bytes

..3.3**3*

Run and debug online!

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

Weijun Zhou

Posted 2017-01-25T18:56:36.350

Reputation: 3 396

2

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.

Try it online.

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

Try it online.

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 interface to class (and added public before static).
  • Changed class-name to Sbccddggmossuvvyy
  • Changed String[]a to String... a
  • Added unused no-op {}-block
  • Added two no-op ;
  • Changed ",ab,ab,ab" to ",,,".replace(",", ",ab")

Kevin Cruijssen

Posted 2017-01-25T18:56:36.350

Reputation: 67 575

1

You have nnn in there... Otherwise, I thought duplicating System.out.print("") seemed verbose, so I played around with some String methods, and managed to save 3 more bytes. Try it online!.

– Ørjan Johansen – 2018-03-19T17:39:34.990

1Another option with the same length. – Ørjan Johansen – 2018-03-19T17:40:46.457

@ØrjanJohansen Thanks! And not sure how I missed that nnn... Also, managed to golf three more by changing String...e to String...f, so we can remove the two e (and one f) in the interface name. – Kevin Cruijssen – 2018-03-19T17:45:44.460

1

Oh, replace can replace all those methods. Try it online!

– Ørjan Johansen – 2018-03-19T18:00:52.280

Yeah, realized that ten seconds after my deleted comment. – Ørjan Johansen – 2018-03-19T18:02:48.520

1

Come to think of it, why not use replace for its intended purpose? Try it online!

– Ørjan Johansen – 2018-03-19T18:19:56.527

2

Japt, 9 bytes

`í`²²²í`í

Try it online!

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.

Bubbler

Posted 2017-01-25T18:56:36.350

Reputation: 16 616

2

Pyth, 9 bytes

GGG\L\L\L

Try it online!

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

u_ndefined

Posted 2017-01-25T18:56:36.350

Reputation: 1 253

2

Pascal (FPC), 51 bytes

begin write('ABCABCABC')end.bbggin  wwrrtt(())dd..'

Try it online!

Boring one, please see below.


Pascal (FPC), 78 75 72 bytes

var f:int32;begin for f:=22to 33do write(' (())..:;;==abbdggvvww')end.a'

Try it online!

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.

Try it online!

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.

Try it online!

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.

Try it online!

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.

Try it online!

Output:

  (())..:;;==bbcdgghhinrrtvvww  (())..:;;==bbcdgghhinrrtvvww  (())..:;;==bbcdgghhinrrtvvww

That v in var really starts to annoy me...

AlexRacer

Posted 2017-01-25T18:56:36.350

Reputation: 979

Once you start adding things after end., you can just put all the extra chars there, scrap the var and for, and write a single constant string. – Ørjan Johansen – 2018-08-28T16:09:33.673

2

INTERCAL, 84 bytes

PLEASE.4<-#4DOREADOUT.4DOREADOUT.4DOREADOUT.4DOGIVEUPPLEASELEAS..4<<--##DDOOUUGGIIVV

Try it online!

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

Try it online!

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

Try it online!

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

Try it online!

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.

Unrelated String

Posted 2017-01-25T18:56:36.350

Reputation: 5 300

1

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.

Try it online

Output:

Each 1 has a space after it.

1 
1 
1 

mbomb007

Posted 2017-01-25T18:56:36.350

Reputation: 21 944

1

MATL, 12 9 bytes

3 Bytes saved thanks to @Luis

JVvJVvJVv

Outputs:

0 +1i
0 +1i
0 +1i

Try it Online!

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.

Suever

Posted 2017-01-25T18:56:36.350

Reputation: 10 257

@LuisMendo Unfortunately since MATL trims trialing newlines it only has 2 :( – Suever – 2017-01-25T21:01:57.640

@LuisMendo Ah you're right! There's also the newline in the TIO version. Thanks – Suever – 2017-01-25T21:04:49.177

1

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.

DLosc

Posted 2017-01-25T18:56:36.350

Reputation: 21 213

1

Retina, 27 bytes


aaabbb
S\`
S\`
S\`
\`\`\`

Try it online

The output is 150 bytes, containing 12 a, 12 b, and 126 newlines.

mbomb007

Posted 2017-01-25T18:56:36.350

Reputation: 21 944

1

Del|m|t, 21 bytes

TIO

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

TIO

; 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

MildlyMilquetoast

Posted 2017-01-25T18:56:36.350

Reputation: 2 907

1

Del|m|t, 15 bytes

TIO

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.

MildlyMilquetoast

Posted 2017-01-25T18:56:36.350

Reputation: 2 907

1

V, 9 bytes

¬ac¬ac¬ac

Try it online!

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.

James

Posted 2017-01-25T18:56:36.350

Reputation: 54 537

1

SmileBASIC, 9 bytes

?12?21?21

Output:

12
21
21

Not the most exciting thing, but it fulfills all 3 recommendations.

12Me21

Posted 2017-01-25T18:56:36.350

Reputation: 6 110

1

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.

P. Ktinos

Posted 2017-01-25T18:56:36.350

Reputation: 2 742

1Output typically has to be to stdout, not stderr. You should ask the OP if that's okay. – mbomb007 – 2017-01-25T22:53:38.433

@mbomb007 Maybe not: http://meta.codegolf.stackexchange.com/a/2451/36398

– Arc676 – 2017-01-26T09:30:17.213

@mbomb007 it's a default for allowed, but ill ask him. – P. Ktinos – 2017-01-26T14:36:49.237

@P.Ktinos It has a lot of downvotes as well. For each 3 upvotes, there are at least 2 downvotes. The other answers are far less controversial. – mbomb007 – 2017-01-26T14:39:10.883

1

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

Carl Colijn

Posted 2017-01-25T18:56:36.350

Reputation: 111

1

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.

SnoringFrog

Posted 2017-01-25T18:56:36.350

Reputation: 1 709

1

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

demo

sergiol

Posted 2017-01-25T18:56:36.350

Reputation: 3 055

1This answer is invalid. The occurrences of each character used in your program must be a multiple of 3. – darrylyeo – 2017-01-28T03:41:20.017

@darrylyeo: fixed now. – sergiol – 2017-01-30T00:33:14.257

1...And that includes the space and the letters in puts. – darrylyeo – 2017-01-30T01:58:43.680

@darrylyeo: Now fixed. Indeed. – sergiol – 2017-02-02T00:20:47.893

1

Python 3, 87 bytes

AET=' TEE'
exec("""print('A TE');exec('print("A AT");exec("print(AET)")')""")
AET=="";

Try it online!

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!

osuka_

Posted 2017-01-25T18:56:36.350

Reputation: 391

1

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.

Stewie Griffin

Posted 2017-01-25T18:56:36.350

Reputation: 43 471

1

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.

idrougge

Posted 2017-01-25T18:56:36.350

Reputation: 641

1

Triangular, 21 bytes

3>\..3...(;...d/dp]%<

Try it online!

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.

MD XF

Posted 2017-01-25T18:56:36.350

Reputation: 11 605

I like how the triangle code contains 30 spaces :) – SK19 – 2018-03-16T22:44:09.470

3Each character in the source should appear three times – Jo King – 2018-03-16T22:55:51.873

1

Braingolf, 27 bytes [non-competing]

20111[!_!_!_+]2200++[][];;;

Try it online!

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)

Skidsdev

Posted 2017-01-25T18:56:36.350

Reputation: 9 656

1

Aceto, 18+1=19 bytes

Requires the use of the command-line switch -l

"aaabbbccc"\p\p\"p

Prints, unsurprisingly, aaabbbccc.

L3viathan

Posted 2017-01-25T18:56:36.350

Reputation: 3 151

1

Attache, 24 bytes

Print!73Print!73Print!73

Try it online!

The output is (with a trailing newline):

73
73
73

For bonus "encouragement" points:

Attache, 30 bytes

"PPrriinntt""""||**33"*3|Print

Try it online!

This is just:

"PPrriinntt""""||**33"*3|Print
"                    "            a string ("" is an escaped double quote)
                      *3          repeated 3 times
                        |Print    then print that string

Conor O'Brien

Posted 2017-01-25T18:56:36.350

Reputation: 36 228

1

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

SK19

Posted 2017-01-25T18:56:36.350

Reputation: 161

1

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.

Titus

Posted 2017-01-25T18:56:36.350

Reputation: 13 814

1

JsFuck, 1044 Bytes

[!!(([[]]))][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+[+[]]]+(![]+[])[+!![]]+(![]+[])[!![]+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]])()(+(+!![]+[!![]+!![]]+(+[])+(+!![])+(!![]+!![])+(+[])+(+!![])+(!![]+!![])+(+[])))

Bad one

l4m2

Posted 2017-01-25T18:56:36.350

Reputation: 5 985

1

Matlab, 12 bytes

1:3,1:3,1:3,

Try it Online!

DimChtz

Posted 2017-01-25T18:56:36.350

Reputation: 916

1

Zsh, 18 bytes

<<<$_
<<<$_
<<<$_

Try it online!

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.

GammaFunction

Posted 2017-01-25T18:56:36.350

Reputation: 2 838

1

ink, 30 bytes

-(i)>:{(-3):{(3)}}


{3>i:->i}

Outputs

>:3
>:3
>:3

and a trailing newline. The output was actually mostly unintentional.

Try it online!

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)

Try it online!

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.

Try it online!

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)

Sara J

Posted 2017-01-25T18:56:36.350

Reputation: 2 576

0

APL (Dyalog Unicode), 9 bytes

,⎕A,⎕A,⎕A

This prints the alphabet, 3 times.

Try it online!

Also works for the digits 0-9:

,⎕D,⎕D,⎕D

Try it online!

J. Sallé

Posted 2017-01-25T18:56:36.350

Reputation: 3 233

0

Runic Enchantments, 9 bytes

aaa333@@@

Try it online!

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.

Draco18s no longer trusts SE

Posted 2017-01-25T18:56:36.350

Reputation: 3 053

-1

import string
import random
nw_ls = list("".join(random.choice(string.ascii_uppercase) for _ in range(40)))
print("".join(nw_ls))
s_ls = dict()
for i in range(len(nw_ls)):
    count = 0 
    for j in range(1,len(nw_ls)-1):
        if nw_ls[i] == nw_ls[j]:
            count += 1
    if count % 3 == 0 and count > 1:
        s_ls[nw_ls[i]] = count
print("".join(s_ls))    

Rohan singh

Posted 2017-01-25T18:56:36.350

Reputation: 1

3Welcome to PPCG! Unfortunately, your answer doesn't seem to follow the challenge specifications - neither the source, nor the output has the number of occurrences of each character equal to a multiple of 3. Also, keep in mind that this is [tag:code-golf], so you should aim for the shortest possible code, and to be considered "serious contender" you should at the very least get rid of multi-char variable names and unnecessary whitespace. – Kirill L. – 2019-03-26T12:29:54.873