# Print every character your program doesn't have

Your task is to build a program (using only printable ASCII characters and/or tabs and newlines) that prints out exactly the characters in the printable ASCII space (0x20 to 0x7e) that don't appear in your program's source code (in any order, however many times you want).

The shortest code to do this in any language wins.

• They are, but they're not in the range 0x20 to 0x7e, which are defined as the "printable ASCII characters". Technically tabs and newlines are actually control characters. – Joe Z. Aug 23 '13 at 19:22
• Are we allowed to print newlines (or any other unprintable ASCII characters)? – flornquake Aug 24 '13 at 0:30
• Tabs and newlines do not render in such a way that they occupy a printing position. They move the position. See the ANSI C "isprint" function. – Kaz Aug 24 '13 at 2:00
• How did this question get revived? It's started getting upvotes again. – Joe Z. Jan 31 '14 at 16:38
• @Timwi: If you wanted to do that, you'd have to output all the characters in the CJK character space too (excluding the ones appearing in your code). It's too complicated to manage, so I restricted it to just ASCII. – Joe Z. Feb 1 '14 at 3:01

# Cubically, 61 bytes

~:5+1-777(B1D1+7)6+33077777(D3B3@6-7)0&2 !"#$%'*,./489;<=>?AC  ### Unique characters in program:  !"#$%&'()*+,-./0123456789:;<=>?@ABCD~


### Output:

EFGHIJKLMNOPQRSTUVWXYZ[\]^_abcdefghijklmnopqrstuvwxyz{|}


# Python 2, 68 8388 (but it actually reads the file)

No comments, no hacks, it just opens itself, and checks the contents. Includes the set logic from this answer.

print"".join(set(map(chr,range(32,127)))-set(open(__file__).read()))


Changed to print the output and not an array.

• Outputs the following characters which are in the program:  127[]acdefrtx – user8943 Aug 24 '13 at 2:24
• @ZeroPiraeus I've corrected that, and have met your score! – user8777 Aug 24 '13 at 5:47
• These are definitely not ASCII characters. ASCII below 32 only contains control codes (Backspace, Bell, etc.), whitespace (CR, LF, tab), and the null char. – Felix Dombek Aug 24 '13 at 13:25
• @Felix These are from Code page 437 (which starts at U+2639, I believe) – Doorknob Aug 24 '13 at 15:02
• You can get this down to 62 chars in python3 using @WolframH 's idea: print(*set(map(chr,range(32,127)))-set(open(__file__).read())). Longer by 1 character than the other answer, but more pythonic in my opinion – Peter Gibson Aug 29 '13 at 1:47

## Bash (pure), 9392 88 bytes

eval "a=$'$(printf '\\x%x' {32..127})'"
while read -rn1 c;do a=${a/"$c"};done<$0 echo$a


### Example

cat > foo.sh # now paste and C-d
bash foo.sh  # !#&*+,45689:>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_bgjkmqsuyz|~
wc -c foo.sh # 93 (including end-of-line \n)


• The eval thing: construct a string that looks like \x20\x21...\x7f, and use bash&ksh's c-style-quote $'c-escape-str' to wrap it, in order to escape it into some real list-of-chars. • Then we use a while loop to read chars one-by-one, and use the 'replace first occurance' ${var/pat} to kill corresponding chars in $a. Note that we didn't set IFS properly, and read by default will consume \x20, \n and \t. The \x20 part will be handled later. • Finally we abuse IFS again so it can eat the space. The output is in ASCII char order. This very literal (for code golfs at least) one actually ended up smaller than what I expected it to be. Otherwise I will be thinking about # !&*+abc.... # brainfuck, 90 bytes ++++[->+++>++++++++<<]>-[->.>+<+<]>+.+++>++[-<.<++>+>]<+.++<++[->.>+<+<]>+.++>+++++[-<.+>]  Try it online! Tape Layout: [Initial Count Cell] , [Counter Cell One] , [Ascii Cell] , [Counter Cell Two] Explanation: ++++[->+++>++++++++<<]>- # sets counter cell one to 11 and ascii cell to 32 [->.>+<+<] # prints ascii 32-42 and creates counter cell two >+.+++>++ # prints ascii 44 and sets counter cell two to 13 [-<.<++>+>] # prints ascii 47-59 and resets counter cell one <+.++<++ # prints ascii 61 and sets counter cell one to 28 [->.>+<+<] # prints ascii 63-90 and resets counter cell two >+.++>+++++ # prints ascii 92 and sets counter cell two to 33 [-<.+>] # prints remaining ascii characters  Output:  !"#$%&'()*,/0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\^_abcdefghijklmnopqrstuvwxyz{|}~


# R, 72 bytes

cat(intToUtf8(setdiff(32:126,utf8ToInt("\\\"(),12368:ITUacdefinostu"))))


Try it online!

With correction from @JayCe

• nicely done! Beats out the default polyglot by a fair margin! – Giuseppe May 15 '18 at 18:49
• I think you're missing \\  in the string which costs 2 bytes :( Otherwise I tried to golf it further but couldn't - clever use of setdiff ! – JayCe May 16 '18 at 20:21

{iii}i{icicicicicic}dd{ci}iicicicici{ic}dd{ci}iciic


Because, y'know, I'm hilarious and original.

Saved 15 bytes by repeating a few characters
Saved 4 more by simplifying both instances of d{ic}i to {ci}

Try it online!

Previous Version (55 bytes):

{iii}i{icicicicicic}ddd{ic}iiicicicici{ic}ddd{ic}iiciic


{POW(77,7)} /*-#!"$%&'9:;<=>?@ABCDFGHIJKLMNQRSTUVXYZ[\]^_abcdefghijklmnopqrstuvwxyz|~  Try it online! Prints 1.604852E+13 The only thing Ink can really do to a string is print it - if you want to do actual string processing, you're meant to hook into external code. This means almost all characters will have to occur in our code, since we generally have no way to print the ones that don't. That means we can basically treat the first occurrence of each character as being free, and see how much stuff we can generate with as few repeated characters as possible. One thing Ink can do is math. We can generate and print a number. With only two repeated characters, the expression {POW(77,7)} becomes 1.604852E+13, which has eleven distinct characters, none of which are used in the expression. At this point, there isn't much more we could generate. We need 7 in our code, and while we might be able to generate a -, we'd need another set of {} to do more math, so that would really be a net negative. So we begin a multi-line comment using /* (because Ink doesn't care if we ever close those) and shove all the rest of the characters we aren't using in there. • -5 bytes by creating a larger floating-point number using POW instead of FLOAT, which then also includes E and + and has fewer repeated characters # Q, 44 -1"c"$til[128]except"i"$"-1\"c$til[28]exp;";


.

q)-1"c"$til[128]except"i"$"-1\"c$til[28]exp;"; 345679:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\^_abdfghjkmnoqrsuvwyz{|}  C++ 143 #include<fstream> #include<iostream> char c[256],d,e=32;int main(){for(std::fstream i(__FILE__);i>>d;)c[d]++;for(;++e<127;)c[e]||std::cout<<e;}  Alternative version using macros - 155 #include"iostream" #define d int main(){while(s,*s)l[*s++]++;for(e=35;++e<127;)!l[e]&&std::cout<<e;} #define t(a)#a #define f(a)t(a) char*s=f(d),l[257],e;d  And a version without 'reflection' (examining own source) - 139 #include"iostream" char h['~'],*a="'()*+,:;<=[]acdefhilmnorstu{}",i='#';int main(){for(;*a;)h[*a++]++;for(;++i<'~';)if(!h[i])std::cout<<i;}  # Bash, with coreutils, 80 p=printf for o in {32..126};{ c=$p $($p "\%o" $o) grep -qF "$c" $0||$p "$c" }  Output is: !#&'}+,/45789:<>}@ABCDEGHIJKLMNOPQRSTUVWXYZ[]^_abhjklmsuvwxyz~  • Never heard about this for v in something; COMPOUND_CMD syntax. Great… – Arthur2e5 Mar 2 '16 at 8:13 • Just a grep replacement, but 5-bytes longer: [[$(<$0) = *"$c"* ]] – Arthur2e5 Mar 2 '16 at 8:15
• only 3 bytes longer now: remove the double quotes – Arthur2e5 Feb 19 '18 at 0:04

# PowerShell, 75 bytes

[char[]](32..39+42+44+45+47+58..90+92+94..96+98+100..103+105..113+115..126)


A different approach than the other PowerShell answer. Here, we manually build a list of ASCII values (...) that aren't in the source code, then cast that as a char-array [char[]]. PowerShell will by default write out values alone on a line like this, so we get printing for free.

Characters used in code: ()+.0123456789[]achr

## Marbelous, 111 bytes

@0
--7E
<XE\
../\@0
:E\
}0}0
&0&1
{0{>
}0
-F
-E
-5
-4
>0
-7
>D
-F
>0
-2
>0
-2
>0
-3
>3
-2
-6
-8
-9
>0
&0&1
\/\/


Main board loops from 0x7E down to 0x20, E\ function rejects values by decrementing and comparing to small numbers (Marbelous' built in < and > operators only work on the range 0-35).

# Python 2, 62

from string import*;print set(printable)-set(open("p").read())


Code must be saved in a file called p.

Lowest python solution so far ;D

## Bash internals only, 133 bytes

w=printf
while IFS= read -r -n1 r;do i[$($w %d \'$r)]=1;done<$0
for r in {33..126};do [[ 1 -ne ${i[$r]} ]]&& $w \$(w "%o" r);done  Save and run with bash <filename> ### Explanation 1. Make printf shorter. 2. For each char r read from 0 (i.e. the script itself), set i[ord(r)] to 1. 3. For each number r in range(33, 127), if i[r] is not 1, printf the char corresponding to the number r. The w $$/extract_itex](w "%o" r) part is where the number-to-char magic is: convert the number to OCT, and then prepend a backslash, and finally feed to printf to really print it. The output is in ASCII order. • Actually I count 132. You can spare a few more characters: pastebin.com/G8YDBzJj – 113 characters. – manatwork Jan 31 '14 at 9:59 • This would get my upvote with some explanation about how it works. – Stéphane Gourichon Mar 19 '15 at 19:37 # Java - 111 Bytes I know I'm 4 years too late, but I just found this question. void SPARE_VOMIT(){System.out.print(0!=('^'>>8|3&6%2<<~7*4)?"#/^@\bc[]":''-5+"lnbfghjkqwxyz".toUpperCase());}  I tried to put as few characters in the ignored String as possible. Ungolfed: void SPARE_VOMIT(){ // vomit out all the spare characters System.out.print(0 != ('^'>>8|3&6%2<<~7*4) ? // Both sides here = 0 "#/^@\bc[]" : // The shame string... ''-5 + "lnbfghjkqwxyz".toUpperCase()); // Print 91 and caps. }  • SPARE_VOMIT... heh... +1 – Magic Octopus Urn Aug 3 '17 at 14:51 # ><>, 444337 35 bytes crossed out 44 is still regular 44 ;( " 'r:{-}30{l4-*?.~~:9e*=?;:l2=?o1+}  Try it online! Outputs !#%&(),/5678<>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[$$^_abcdfghijkmnpqstuvwxyz| ### How It Works: " Wrapping string literal, adding the source code to the stack. This adds a space at the start to initialise the counter ' Runs another string literal over the whole code This means both " and ' are added to the stack r: Get the counter from the bottom of the stack and duplicate it {-} Get the bottom of the stack and check if it is equal to the counter. Push the check to the bottom of the stack 30 Add 3, 0 to the stack for later {l4-* Get the equality check from the bottom of the stack and OR it with whether the stack is empty of values to check against ?. If the character is equal or the stack is empty, continue. Else set the instruction pointer to 3,0 to check against the next character ~~ Pop the excess 3,0 :9e*=?; Check if the counter is equal to the 126, the last character, and end if so. :l2=?o If the stack is empty of values to check (ie the character is not in the code), print it. 1+} Add one to the counter and, because ><> is toroidal, loop back to the beginning  # Memory GAP, 3104 bytes 74b87337454200d4d33f80c4663dc5e5f7bd60b75b29d79b660a2859395c1a240e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf47cef8a734855777c2a9d0caf42666e69b21afc54fb48d153c19101658f4a2a480e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf4594f803b380a41396ed63dca39503542f7bd60b75b29d79b660a2859395c1a240e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a092433247bce5c74f589f4867dbd57e9ca9f808f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4594f803b380a41396ed63dca395035420e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a0924332f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a09243320cc175b9c0f1b6a831c399e269772661f7bd60b75b29d79b660a2859395c1a24f24c2c15b9d03797c6874986a8d1951634ec78fcc91ffb1e54cd85e4a0924332faf05c15dfad45dafd1fc23d51236853f0a1dfdc675b0a14a64099f7ac1cee8374b87337454200d4d33f80c4663dc5e5f7bd60b75b29d79b660a2859395c1a240e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e54cd85e4a09243320cc175b9c0f1b6a831c399e269772661f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4594f803b380a41396ed63dca39503542f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a0924332faf05c15dfad45dafd1fc23d5123685334ec78fcc91ffb1e54cd85e4a09243320cc175b9c0f1b6a831c399e269772661f7bd60b75b29d79b660a2859395c1a24f0a1dfdc675b0a14a64099f7ac1cee83f24c2c15b9d03797c6874986a8d1951634ec78fcc91ffb1e54cd85e4a09243327cef8a734855777c2a9d0caf42666e69b21afc54fb48d153c19101658f4a2a48a87deb01c5f539e6bda34829c8ef2368c68271a63ddbc431c307beb7d2918275852438d026c018c4307b916406f98c6274985f5115ad149212a917dbef8ec801b21afc54fb48d153c19101658f4a2a480cc175b9c0f1b6a831c399e269772661f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf474b87337454200d4d33f80c4663dc5e5f7bd60b75b29d79b660a2859395c1a240e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243324124bc0a9335c27f086f24ba207a4912f7bd60b75b29d79b660a2859395c1a24f24c2c15b9d03797c6874986a8d1951634ec78fcc91ffb1e54cd85e4a0924332faf05c15dfad45dafd1fc23d5123685374985f5115ad149212a917dbef8ec801  Try it online! Expanded: 74b87337454200d4d33f80c4663dc5e5f7bd60b75b29d79b660a2859395c1a240e9f1e8e40bb79e8 00b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4 34ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e 54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf47cef8a734855777c2a9d0caf42666e69 b21afc54fb48d153c19101658f4a2a480e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e8 00b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf4594f803b380a41396ed63dca39503542 f7bd60b75b29d79b660a2859395c1a240e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e8 00b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf4 34ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e 54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a0924332 47bce5c74f589f4867dbd57e9ca9f808f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e 54cd85e4a092433234ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4 594f803b380a41396ed63dca395035420e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e 54cd85e4a0924332f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a0924332 0cc175b9c0f1b6a831c399e269772661f7bd60b75b29d79b660a2859395c1a24f24c2c15b9d03797 c6874986a8d1951634ec78fcc91ffb1e54cd85e4a0924332faf05c15dfad45dafd1fc23d51236853 f0a1dfdc675b0a14a64099f7ac1cee8374b87337454200d4d33f80c4663dc5e5f7bd60b75b29d79b 660a2859395c1a240e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a0924332 0e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e8 00b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4 0e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e 54cd85e4a09243320cc175b9c0f1b6a831c399e269772661f7bd60b75b29d79b660a2859395c1a24 34ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4594f803b380a4139 6ed63dca39503542f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a0924332 faf05c15dfad45dafd1fc23d5123685334ec78fcc91ffb1e54cd85e4a09243320cc175b9c0f1b6a8 31c399e269772661f7bd60b75b29d79b660a2859395c1a24f0a1dfdc675b0a14a64099f7ac1cee83 f24c2c15b9d03797c6874986a8d1951634ec78fcc91ffb1e54cd85e4a09243327cef8a734855777c 2a9d0caf42666e69b21afc54fb48d153c19101658f4a2a48a87deb01c5f539e6bda34829c8ef2368 c68271a63ddbc431c307beb7d2918275852438d026c018c4307b916406f98c6274985f5115ad1492 12a917dbef8ec801b21afc54fb48d153c19101658f4a2a480cc175b9c0f1b6a831c399e269772661 f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e8 00b0cc9433830cf474b87337454200d4d33f80c4663dc5e5f7bd60b75b29d79b660a2859395c1a24 0e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e8 00b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4 34ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e8 00b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4 34ec78fcc91ffb1e54cd85e4a09243324124bc0a9335c27f086f24ba207a4912f7bd60b75b29d79b 660a2859395c1a24f24c2c15b9d03797c6874986a8d1951634ec78fcc91ffb1e54cd85e4a0924332 faf05c15dfad45dafd1fc23d5123685374985f5115ad149212a917dbef8ec801  ## Explanation Memory GAP's instructions are md5 hashes of their actual instructions. Using ; as a delimiter, this is the "original" program: ; aaaa;size;dup;add;dup;add;dup;add; dup;open;pop; dup; dup; dup; aaaaa;size;dup;dup;dup;dup;add;add;add;dup;add;aaa;size;add;add;dup;aaaaa;dup;add;size;add;a;size;neg;add; btwn; swap; aaaa;size;dup;add;dup;add;dup;add;dup;dup;add;add;a;size;add;dup;aaaaa;size;add;btwn; add; a;size;swap;neg;add; open; pop;char;out;nil;shut;pop; a;size;add; dup; aaaa;size;dup;add;dup;add;dup;add; dup;dup;add;dup;add;aa;size;neg;add;btwn; shut;  This simply iterates over the range between 32 and 126, and prints it if and only if it does not fall between '0' and '9' or 'a' and 'f'. # Z80Golf, 83 bytes 00000000: 2b2b 7036 092e 452c 453b 3b78 6f2c 4523 ++p6..E,E;;xo,E# 00000010: 2323 2323 2323 2323 2323 2323 2323 2329 ###############) 00000020: 2929 2929 2929 2929 307e 7620 2122 2425 ))))))))0~v !"$%
00000030: 2627 282a 2d2f 3132 3334 3537 3839 3a3c  &'(*-/12345789:<
00000040: 3d3e 3f40 4142 4344 7172 7374 7577 797a  =>?@ABCDqrstuwyz
00000050: 7b7c 7d                                  {|}


Try it online!

Printable characters aren't too useful in z80, but we can write this:

   dec hl
dec hl
ld (hl),b
ld (hl),9
ld l,'E'
inc l
ld b,l

dec sp      ; $0009 starts here dec sp ld a,b ld l,a inc l ld b,l inc hl inc hl inc hl inc hl inc hl inc hl inc hl inc hl inc hl inc hl inc hl inc hl inc hl inc hl inc hl inc hl add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl jr nc,$+2+'~'
halt
db " !\"$%&'(*-/12345789:<=>?@ABCDqrstuwyz{|}"  The idea is to print characters from 'F' to 'n', and put all the remaining characters in the code (the "garbage" string at the end). The preamble writes 09 (tab) to $fffe, so that we can point SP there to jump to $0009 after putchar. The ld (hl), b achieves nothing; I just get rid of 'p' there. L is initialized to 'E'+1, and counts up until (HL+17) << 9 overflows (sets the carry), which is when L is 111 = 'o', the first character we don't want to print. If the carry is not set, we jump over a halt instruction and the garbage string, into thousands of NOPs, the PC eventually running into putchar =$8000 and returning to $0009. See this answer for some more info on how this code prints characters in the first place. • nvm I saw that the code had to be printable as well. – qwr Jun 20 '18 at 19:16 # dc, 83 79 bytes 120d115 108 100 93 91 80 62[d1-d43<:]ds:x[l.dP]s;34s.[dl.!=;s,l.1+ds.127>/]ds/x  Try it online! Prints "#$%&'()*?@ABCDEFGHIJKLMNOQRSTUVWXYZ\^_abcefghijkmnopqrtuvwyz{|}~

The lazy answer of commenting out the entire printable range (and printing nothing) would be 95 bytes, so while this may be suboptimal, I'm pretty pleased.

120d115 108 100 93 91 80 62[d1-d43<:]ds:x puts all the values on the stack that we need to ignore. Decimal is seemingly the ideal base for this, particularly when I factor in the additional characters that would be needed to change the input base. The first few values I have to enter in manually, but I use all the characters from 43-62, so I can generate those in a loop. I don't need to use a few of these characters, but it saves bytes to run through the ones that I don't need, so I named my registers/macros :, ., ,, ;, and / for the sake of using those characters.

[l.dP]s; is the macro that will print the character if it's not in the list. 34s. is the counter - since I use characters 32 and 33, I just start at 34. [dl.!=;s,l.1+ds.127>/]ds/x is a pretty straightforward macro, just load the counter, ., see if it's in the list, run ; if so, increment, and loop until we're out of printable range.

Golfed off four bytes because I was accidentally omitting p (this also made my answer invalid!). I must have at one point used both P and p to print, or thought I would have to.

# Ruby (50)

puts (?#..?~).to_a.join.tr"()?!#.,~_aijnoprstu",""


Outputs:

$%&'*+-/0123456789:;<=>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^bcdefghklmqvwxyz{|}  ## Python, 94 print !"#$%&'90*+,-.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[/\]^_abcdefghjklmoqsuvwxyz{|}

• The "do nothing" solution was already posted. – Joe Z. Nov 27 '13 at 22:15
• @JoeZ. I've changed it to do something – Timtech Nov 28 '13 at 12:06

# Ruby 2.1.0

## 206 204 characters

chars_in_source = File.read("self.rb").chars.uniq.map(&:ord)
printable_ascii = (20..126).to_a
not_in_source = printable_ascii.reject { |c| chars_in_source.include?(c) }

puts not_in_source.map(&:chr).join


And the output is:

#$%'*+,-/345789;<>@ABCDEGHIJKLMNOPQRSTUVWXYZ[\]^gkvwxyz~  Not the shortest here (in fact, it might be the longest). But that's the great thing about this: it got me to go try something I'd never done before. • VariableNamesGreaterThanOneCharacterLongException on line 1 – CalculatorFeline Mar 2 '16 at 4:38 # Python, 88 81 78 77 bytes ## actually reads the file I tried to do it the 'clean' (as in 'easy to read') way, turned out quite nice, although i'm still new to python and probably this can be shortened as well. file named 'a' is the file executed. from string import* for c in printable: if c not in open('a').read():print c  And it prints out all the ASCII characters not found in source file. I know this was supposed to be a clever hack (as in all those which contain all the ascii set or addresses, or use an error), but I wanted to do explicitly what was asked :] Anyone has a suggestion how to make it even shorter while still going in this direction?  trimmed one more char, thanks for the tip! • Timtech's tip makes possible to reduce 1 more character. – manatwork Jan 31 '14 at 12:30 ### Javascript 78 chars bghjklm()seuABCDEFGHIJKLMNOPQRSTUVWXYZvwyz!@#$%^&*1234567890{}[]-=_+\;"'.,<>/?


Outputs:

SyntaxError: Unexpected identifier


Not the shortest code, but threw a try for fun. Notice the colon (:) and space () are covered in Output also.

Feedback appreciated.

• And I just notice now that @xem has already done something similar to my code. Sorry, at CodeGolf people (and xem), if you all consider what I did unknowingly is copying another's work, I will happily delete my answer. – Gaurang Tandon Jan 31 '14 at 14:54

# PYG 0.1 (17):

P(*Se(STP)-Se(Q))


prints

$, 0 4 8 < @ D H L X \  d h l p t x | # ' + / 3 7 ; ? C G K O W [ _ c g k o s w { " & . 2 6 : > B F J N R V Z ^ b f j n r v z ~ ! % 1 5 9 = A E I M U Y ] a i m q u y }  Not the shortest, but it gets the job done. Also, since I just created this "Language" (it's actually shortend Python), I'll explain what it does. • Q gives the program's code • STP gives all printable characters • Se is equal to Python's set • - substracts the two sets • * is also the same as python's • P prints it. Knowing this, this would convert to the following python: for i in set(__import__("string").printable)-set(open(__file__).read()): print i # Befunge, 44 characters $#~"01g!#@_:01>g#1-#0*#:_!> #,!#g!_01g1+01p


it has exactly one quotation mark in the code, so that whenever it is executed, the program enters string mode, reading the code until it loops back to the same quotation mark, stops string mode and continues execution.

it does this for every printable ascii character, rejects it if it's in the code and continues. maybe i'll golf it more later

# CBM BASIC v2.0 - 63

0fori=84+5to127.
3?chr$(i);:next 6rem "!#%&'*,-/<>@abdgjklmpqsuvw  # ><>, 86 bytes Naive implementation : for each character in the 0x20 - 0x7e range, browse its codespace until it reaches the character or the end of the codespace. ' 'v1+>}:{:@@g:?!v{:}=?v30. > >00^ 0+1v!?~< ^+1;?='~':< ~~< ~:o ^ >  Output : "#$%&()*,-/2456789ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]_abcdefhijklmnpqrstuwxyz|


This is definitely golfable, I'll try to improve the flow control later.

say [~] keys (' '..'~') (-)$*PROGRAM.comb # 41 bytes  IYZnCpl?W8|}K!^i"Bhuvw6F<\S,=JrVLQE54%Xqg_1{/3+Tjx#Ht&;7>02@ND:9Udfz  The reason the order of the output is random is that the Set Minus operator (-) produces a Set, which is inherently unordered. # Javascript/coffeescript/actionscript/more, 96 // #qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890~!@$%^&*()-_=+[{]}\|;:'",<.>?


Other languages it works in are basically anything with // comments (and doesn't need something like class a{public static void main(String[]a){) This also works in Perl 5 (Thanks @BradGilbertb2gills for pointing that out!)

• I was just about to comment that this would work in almost any language... – Sparr Nov 18 '15 at 23:47
• # qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890~!@/\$%^&*()-_=+[{]}\|;:'",<.>? Python - 95 bytes EDIT: Damn code blocks – DJgamer98 Nov 19 '15 at 14:59
• If you placed the # character before qwerty then it will also work in Perl 5. – Brad Gilbert b2gills Nov 29 '15 at 19:16
• @BradGilbertb2gills cool! – ev3commander Nov 29 '15 at 21:17
• Perl 5 will either see // as a null regex, or a defined-or operator. (say undef // 1) I'm not sure which. ( If it is the latter, it may only work on 5.10 or newer ) – Brad Gilbert b2gills Nov 29 '15 at 21:41