# Invert a Quine!

We all know what a quine is. An inverted quine is a non-empty program that prints the inverse of its source code without reading its source code, and consists solely of printable-ASCII characters (space through ~).

Here, “inverse of the source code” means the following: the output of your program must contain each printable ASCII character (m − c) times, where c is the number of times said character occurs in your code, and m is the maximum number of times any character is repeated in your code.

(In other words: your code + your output = permutation of m times all of printable-ASCII.)

For example, if your program is 12345, then m = 1, and you should output any permutation of this string:

## CJam, 17 bytes

{s95c+'|,32>\-}_~


Try it online!

Prints

 !"#$%&()*./014678:;<=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^abdefghijklmnopqrtuvwxyz  ### Explanation The goal was to modify the standard quine {"_~"}_~  such that no character is repeated in the program. The reason for this is that CJam has a set different operator which we can use to remove characters from the printable ASCII range, but it doesn't take number of occurrences into account. Implementing that by hand would probably be longer, so I needed to make sure that every character appears only once and we don't have to worry about occurrences. { e# Quine framework. Executes the block while leaving another copy of the e# block on the stack. s e# Stringify the block, giving us "{s95c+'|,32>\-}". 95c e# Convert 95 to a character, which gives us '_' without repeating e# it in the source code. + e# Append it to the string. We don't need to worry about '~', we'll just e# leave it out of the printable ASCII range to begin with. '|, e# Get a character range from the null byte up to '{'. This omits "|}~", e# but those are in the program anyway, it doesn't matter. 32> e# Discard the unprintable characters. \- e# Subtract the source string from the printable ASCII range. }_~  # Python 3, 83 bytes print(~2/8,6>9)#!"$%&'*+14:;<=?@ABCDEGHIJKLMNOPQRSTUVWXYZ[\]^_bcdfghjkmoquvwxyz{|}


Try it online!

Prints -0.375 False.

A?9L<J, !"'#$%&()*+-./:;=>@BCDEFGHIKMNOPQRSTUVWXYZ[\]^_{|}~  Try it online! Old answer invalidated by "only-ASCII characters", a lot of commands aren't valid here. It prints abcdefghijklmnopqrstuvwxyz012345678 one time as there are no duplicated characters. # Version with BCDEFGHIKMNOPQRSTUVWXYZ removed: Work in progress... I think ~60 bytes is as low as you get without non-ASCII characters in 05AB1E.. # 05AB1E, 58 bytes T5+FA'uK?Au"ADLJFKST"SK?9L<5KJ?} !#$%&()*>-./:;=@[]^_{|~\


Try it online!

Prints the output x12 due to the repeated characters:

['""', '55', '???', 'AAA', 'FF', 'JJ', 'KKKK', 'LL', 'SS', 'TT', 'uu']


It also doesn't terminate quite correctly, working on that now...

Invalid old answers (due to non-ASCII characters) have been removed, see edit history.

• "An inverted quine is a non-empty program that prints the inverse of its source code without reading its source code, and consists solely of printable-ascii characters." I was working on an 05AB1E answer, too, until I noticed this. Oct 18, 2017 at 13:50
• @KSmarts fixed at a cost of 76 bytes. Oct 18, 2017 at 13:53
• Typically, in a code-golf challenge, one would expect 05AB1E to do a little better than, "beats Java". Oct 18, 2017 at 13:54
• @KSmarts shrug if you don't let esolangs easily compete by definition, you deserve a sarcastic esolang answer :P. Oct 18, 2017 at 13:55

# Java 8, 10699 190 bytes

class i {/*{}!"#$%&'()+,-.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_bdefghjkmnopqrtuvwxyz|~!"#$%&'()+,-.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_claibdefghjkmnopqrtuvwxyz|~*/}

• You can probably golf it by removing the space in i { because you already have a space
– Okx
Oct 18, 2017 at 13:30
• I believe that every character must occur the same number of times for this to be valid Oct 18, 2017 at 13:33
• I'm not sure if I understand the challenge completely, but isn't just class i{/*!"#$%&'()+,-.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_bdefghjkmnopqrtuvwxyz|~*/} enough? It contains all printable-ASCII in it's source code, and outputs nothing. The part "duplicated for every repeated character in the source code" applies to the output, so even though s is duplicated in class and * and / are duplicated due to /* */, outputting four times nothing is still nothing. Oct 18, 2017 at 14:31 • Also, if I'm indeed correct, you can also golf it to: interface Z{}//!"#$%&'()*+,-.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY[\]^_bdghjklmopqsuvwxyz|~ (97 bytes) Oct 18, 2017 at 14:37

# Javascript (ES6), 103 101 bytes

_=> !"#$%&'()*+,-.0123456789:;<?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^abcdefghijklmnopqrstuvwxyz{|}~//_=>\\  Old solution (103 bytes using alert) alert;;alert\ \!"#$%&'()*+,-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_bcdfghijkmnopqsuvwxyz{|}~


Old (invalid) solution (96 bytes)

alert()// !"#\$%&'*+,-.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_bcdfghijkmnopqsuvwxyz{|}~

• You have two //, which means you must output the printable characters, with one /` removed. (I think) Oct 18, 2017 at 16:06
• @StewieGriffin Fixed Oct 18, 2017 at 16:25