74
\$\begingroup\$

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.

\$\endgroup\$
14
  • 5
    \$\begingroup\$ Do newlines count (as a distinct character) ? \$\endgroup\$
    – zeppelin
    Commented Jan 25, 2017 at 19:05
  • 4
    \$\begingroup\$ Are programs that consist entirely of literals allowed? (There are a lot of languages where 123123123 will work, as currently written.) \$\endgroup\$
    – user62131
    Commented Jan 25, 2017 at 19:09
  • 2
    \$\begingroup\$ @zeppelin Yes, newlines count as a distinct character. \$\endgroup\$
    – darrylyeo
    Commented Jan 25, 2017 at 19:58
  • 2
    \$\begingroup\$ What I mean to ask is, can a program output e.g. abcabcabc with a trailing newline? \$\endgroup\$ Commented Jan 25, 2017 at 20:18
  • 2
    \$\begingroup\$ The challenge title doesn't meet the criteria, lol \$\endgroup\$
    – mbomb007
    Commented Mar 19, 2018 at 14:11

94 Answers 94

2
\$\begingroup\$

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

\$\endgroup\$
2
\$\begingroup\$

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
\$\endgroup\$
2
\$\begingroup\$

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")
\$\endgroup\$
6
  • 1
    \$\begingroup\$ 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!. \$\endgroup\$ Commented Mar 19, 2018 at 17:39
  • 1
    \$\begingroup\$ Another option with the same length. \$\endgroup\$ Commented Mar 19, 2018 at 17:40
  • \$\begingroup\$ @Ø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. \$\endgroup\$ Commented Mar 19, 2018 at 17:45
  • 1
    \$\begingroup\$ Oh, replace can replace all those methods. Try it online! \$\endgroup\$ Commented Mar 19, 2018 at 18:00
  • 1
    \$\begingroup\$ Come to think of it, why not use replace for its intended purpose? Try it online! \$\endgroup\$ Commented Mar 19, 2018 at 18:19
2
\$\begingroup\$

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

\$\endgroup\$
1
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Aug 28, 2018 at 16:09
2
\$\begingroup\$

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
\$\endgroup\$
2
\$\begingroup\$

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.

\$\endgroup\$
2
\$\begingroup\$

Google Sheets, 12

+++111222333 outputs 111222333.

Tricks Used:

The leading + gets auto-corrected to an =.

\$\endgroup\$
2
\$\begingroup\$

Knight, 9 bytes

O!O!O!000

Try it online!

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.

\$\endgroup\$
2
\$\begingroup\$

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

Try it Online!

\$\endgroup\$
2
\$\begingroup\$

Zsh, 12 bytes

yes yes yes 

Attempt This Online!

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

Attempt This Online!

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.

\$\endgroup\$
2
\$\begingroup\$

Flipbit, 15 bytes

^...>^...>^...>

Try it online!

Outputs 0x01x3, 0x03x3, and 0x07x3.

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

SmileBASIC, 9 bytes

?12?21?21

Output:

12
21
21

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

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ @LuisMendo Unfortunately since MATL trims trialing newlines it only has 2 :( \$\endgroup\$
    – Suever
    Commented Jan 25, 2017 at 21:01
  • \$\begingroup\$ @LuisMendo Ah you're right! There's also the newline in the TIO version. Thanks \$\endgroup\$
    – Suever
    Commented Jan 25, 2017 at 21:04
1
\$\begingroup\$

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

\$\endgroup\$
1
\$\begingroup\$

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

\$\endgroup\$
0
1
\$\begingroup\$

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!

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

Aceto, 18+1=19 bytes

Requires the use of the command-line switch -l

"aaabbbccc"\p\p\"p

Prints, unsurprisingly, aaabbbccc.

\$\endgroup\$
1
\$\begingroup\$

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
\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

JsFuck, 1044 Bytes

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

Bad one

\$\endgroup\$
1
\$\begingroup\$

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!

\$\endgroup\$
1
\$\begingroup\$

Matlab, 12 bytes

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

Try it Online!

\$\endgroup\$
1
\$\begingroup\$

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)
\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

naz, 12 bytes

3a3o3a3o3a3o

Outputs 333666999.

This contains six 3's, three a's, and three o's.

\$\endgroup\$
1
\$\begingroup\$

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.
  • .n pops one item and output it as a decimal integer (if any).

Try it online!

\$\endgroup\$
1
\$\begingroup\$

JSFuck (eh, plain JavaScript), 2820 bytes

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

Try it online!

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

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.