text:
What's the shortest contiguous subset of ASCII you need to output the rest?
The printable ASCII characters (hex codes 20 to 7E) in order are:
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

(Note that space is in there.)
This string clearly contains all the printable ASCII characters at least once in increasing order when read from left to to right, but not in decreasing order.
The string reversed:
~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! NORMAL: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

contains all the printable ASCII characters at least once both in increasing and decreasing order. In other words, when the characters are valued with their numeric code, the longest increasing and longest decreasing subsequences have length 95 (the number of printable ASCII characters).
Challenge
Choose a contiguous subset of N printable ASCII characters, such as LMNOP (N = 5). Write a program using only those N characters whose output contains all 95 ASCII characters in increasing and decreasing order like the example above.
The winner is the submission with the lowest N. In case of ties the shortest code in bytes wins.
Notes

A contiguous subset means a set of the printable ASCIIs that all appear in an unbroken line, such as LMNOP or 89:;<=>.
Your contiguous subset may "loop around" from ~ to space, but this incurs a +3 penalty on N. So {|}~ has N = 4, but {|}~ ! has N = 6 + 3 = 9.
Your program may only contain the N printable ASCII characters from the contiguous subset you've selected. They do not all have to appear and may appear multiple times in any order. (All non-printable ASCII and all non-ASCII is not allowed. This means tabs and newlines are not allowed.)
Your output may only contain printable ASCII characters and must be less than 10000 characters long.
Your output's longest increasing and decreasing subsequences must both have length 95 (as explained above).
Output to stdout. There is no input.
N is a positive integer less than 96.

At last, a challenge built for Brainfuck!

{|}~ ! is 6 + 3 = 9.

I think that the only thing that'll beat the current entries is something that will accept 0s and 1s as input; that'd give you N = 2

Given the kinds of answers this is attracting (which are clearly the optimal way), it might be interesting for the score to be some combination of program shortness and number of characters used. Perhaps minimizing n*m where n is the size of the subset of ascii, and m is the length of the program?

@J.P. "The winner is the submission with the lowest N. In case of ties the shortest code in bytes wins." General consensus is that it is bad form to change the rules at a late stage. The winning answer will be the shortest program in Unary (which is basically the shortest program in Brainfuck, just coded differently.)

I would suggest, though, that those posting in Unary might like to put an approximation of their code length in scientific notation, rather than making us squint to count the digits.

@J.P. Yeah, it's too late to change the scoring method now.

@steveverrill - Done.

Welcome to CodeGolf, where 90% of all questions are hijacked. ;)

If no non-printable ASCII is allowed, that means no newlines, which pretty much excludes any language that requires newlines, right?

@Gabe That's right.

I think you mean continuous, not contiguous.

Unary, N=1
14680262330376163203871465704220787333741951071 bytes
Uses only the '0' byte (ASCII 49).
Golfed about 4.1325279×1060 bytes out of @Comintern's solution. Credit still to him :)
In the original Brainfuck:
++++++++[->++++<]>
[>+>+++<<-]>>-
[-<.+<+>>]<<
[>-.<-]

LOL! Love the byte reduction counts in Unary, they always make me laugh. Nice golf of the underlying Brainfuck, +1

It's a shame it's still 14,680,262,330,376,163,203,871,465,694,220 bytes longer than the maximum (10,000). Maybe you can golf a bit more?

@Gabe: The output is limited to 10,000 characters. The program length is not bounded.

@nneonneo: Oh, well carry on then!

Unary, N=1
4132527913354820031118363262102424570092493175835499123283719 (4.1325279e+60) bytes
Source code in unary is obviously too large to post here. It can be easily reproduced by typing out (or generating) a file filled with "0"s of the same length as the number of bytes above.
Here is the binary representation:
1010010010010110011000010010010010010010010010001111000000010010010010010110011000010010010010010010010010010010010010010010010010010010010001111000110011001010001100010000000111001110011001011100000111

And the equivalent Brainf**k code (linebreaks for clarity):
++++[->++++++++<]>>
+++++[->+++++++++++++++++++<]>
[-<+<.+>>]<
[-<-.>]

Output:
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!

EDIT: Golfed out 9.097887e+87 unnecessary characters.

Damn. Here I was feeling clever for getting N=2. +1, and also for golfing out more characters than there are atoms in the universe.

@nneonneo - Right tool for the job, my friend. Usually it sucks as a golfing language...

BTW I think you forgot to add a leading 1 (mandated by the Unary spec).

@nneonneo - Good catch, corrected.

Hahaha +1 just for "Golfed out 9.097887e+87 unnecessary characters."

I didn't know "Unary" existed, so I was going to invent it, except I was going to just use the letter "O".  Then I was going to write a database in it.  Now that this answer has introduced me to it, I guess I can just make a variant of Unary instead... Onary?

Show us the code or it's not an answer. :-) More to the point: this answer is basically just a (well-supported) claim that such a program exists in an abstract space of possible programs, but I claim the physical instantiation of such a program is impossible and thus this is a non-solution. :-)

+1 for a solution that involves more than 10^39 times the amount of bytes that exist in the world!

Considering the number of bytes, one of the best parts of the answer is "easily reproduced".

@R.. I think this counts. It's along the same lines as using the C preprocessor, albeit much more absurd.

@R.. I think this is a valid answer. Unary is a real language, however esoteric, so this is not just a claim that such a program exists.

It's not a real language because you can't express a program in it. It's just a non-realizable expression of another language. Non-realizable because there are not that many bytes of storage, and even if there were, you could not count them reliably (the error rate counting would be sufficiently higher to make all program executions fail).

@R.. If you're concerned with the file storage requirement, remember that it would be fairly trivial to compress the file and/or memory holding the source code because there is only one symbol.  Obviously, if you decompress it all at once to ASCII you would hit hardware limitations. I could even toss together a Unary IDE that let you browse through all the bytes with a scroll-bar and still only use a small HDD footprint for the source file.

+1 for making me think about the fact that every program I write is just a really large number. And for possibly removing the most characters in a golfing ever!

@Comintern: You can't write such a compressor/decompressor which actually runs (before the heat death of the universe) unless it just cheats and assumes all characters of the program are the same and only the file size is significant, and thereby gets away without ever storing the contents of the program. And at that point I claim the size (in whatever form you encoded it, i.e. not unary) is the actual program and does not use only one character to represent it.

@R.. I'm not sure why you think that's 'cheating'.  If all the characters are the same, I'd call it 'efficient'.

@Comintern: Because it's not actually a compressor/decompressor then. It's making assumptions about its data. Any "compressor" whose run time is less than O(n) in the size n of the data is not a compressor. But this is getting to be a stupid topic. People are free to agree with your view or mine as they wish.

"And the equivalent Brainf**k code (linebreaks for clarity):" -- is that a joke?

@AcidShout - Actually it wasn't.  The first line sets cell 1 to 32, the second line sets cell 3 to 95, line three is the ascending ASCII sequence (and sets cell 2 to 95), the last line is the descending ASCII sequence. Much easier to read on 4 lines. The EDIT: and "easily reproduced by typing" were jokes though.

Whitespace.  N=1, there's no need to write the program to see this.  It's also a lot shorter than those insane Unary programs.

@LorenPechtel - You couldn't do a valid Whitespace program - by spec it has to end in 3 linefeeds (ASCII hex 0A) and the challenge defines printable ASCII as hex codes 20 to 7E. You also can't perform I/O without linefeeds.

@Comintern I misread the rules--I was thinking you didn't count the non-ASCII, not that you weren't allowed them.

Here is a shortened version of the BrainF_ck code for anyone who wants that (requires an interpreter that uses wrapping); from 67 to 56 characters (could be made shorter): >>-[-[-<]>>+<]>-<<<<->--<[+[+<]>>+]<+[>>.+<+<-]>+[>.-<-]

@R.. A decompressor that assumes all characters are the same is not cheating, if you create a special compressed file format that only allows a single character. In that case, the fact that all characters are the same is a hard fact, not an assumption, so the decompressor can rely on that fact.

Here's some Haskell code for running the program, I haven't had time to test it yet, however: main = readProcess "unary" [] (genericReplicate 4132527913354820031118363262102424570092493175835499123283719 '0').

@hvd: You've fundamentally changed the definition of 'character' when you no longer have a character set but a single 'character' and the only relevant property is how many of them you have. Much like "base 1" fundamentally changes the definition of "base" (it's not a special case of "base N").

@TimS. this is one of the fundamental assumptions behind the Gödel theorem.  I would suggest reading the Goedel, Escher, Bach book for a very thorough explanation.

@R.. "base 1" is a special case of "base N". It is a degenerate case, but a degenerate case is still a special case.

Cannot reproduce

Brainfuck, N=2
----------------------------------------------------------------------------------------------------------------------------------.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.

24,383 bytes. Uses only - and . (ASCII 45 and 46). Try it here: http://esoteric.sange.fi/brainfuck/impl/interp/i.html. Can probably be parsed as Morse code with the right spaces.
Requires an interpreter adhering to the traditional definition of Brainfuck, which uses an array of (at least) 30,000 byte cells, all initialized to zero.

Very good. This occured to me after I went to bed :-D

How does this work? There's only one output at the end, I don't understand how it can output the whole 95 character string.

@LeoKing you need to be more observant. there are 256-126=130 -, then the descending part .-.-.etc then the ascending part (groups of 255 - followed by a .) As far as I can tell it's all there. Also see edit on my answer for explanation.

Oh sorry, when I scrolled along I thought it was just a string of - with just one . at the end :). My bad.

+1 "Can probably be parsed as Morse code with the right spaces."

"Can probably be parsed as Morse code with the right spaces." Coincidentally I have a program that I wrote in C# that reads text and beeps it back as morse code. Internally it converts the characters into - and ., so with a bit of modification it could probably be done.

CJam - N=3; 7659 bytes
''(((((((''((((((''(((((''((((''(((''((''('''(')'))')))'))))')))))'))))))')))))))'))))))))')))))))))'))))))))))')))))))))))'))))))))))))')))))))))))))'))))))))))))))')))))))))))))))'))))))))))))))))')))))))))))))))))'))))))))))))))))))')))))))))))))))))))'))))))))))))))))))))')))))))))))))))))))))'))))))))))))))))))))))')))))))))))))))))))))))'))))))))))))))))))))))))')))))))))))))))))))))))))'))))))))))))))))))))))))))')))))))))))))))))))))))))))'))))))))))))))))))))))))))))')))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))))'))))))))))))))))))))))))))))))')))))))))))))))))))))))))))))'))))))))))))))))))))))))))))')))))))))))))))))))))))))))'))))))))))))))))))))))))))')))))))))))))))))))))))))'))))))))))))))))))))))))')))))))))))))))))))))))'))))))))))))))))))))))')))))))))))))))))))))'))))))))))))))))))))')))))))))))))))))))'))))))))))))))))))')))))))))))))))))'))))))))))))))))')))))))))))))))'))))))))))))))')))))))))))))'))))))))))))')))))))))))'))))))))))')))))))))'))))))))')))))))'))))))')))))'))))')))'))')'(''''(''((''(((''((((''(((((''((((((''(((((((

Try it at http://cjam.aditsu.net/

What..just what...

@Calvin'sHobbies just incrementing and decrementing characters :)

Are you sure this isn't LISP?

Brainf**k, N=4
My first brainfuck program. Uses 3 characters out of the block +,-. (Ascii 43 to 46.)
410 bytes (one . can be deleted from the program if the double ~~ can be reduced to a single ~.)
Here's the list of commands in that area of the ASCII table (I don't need the input command):
+   increment (increase by one) the byte at the data pointer.
-   decrement (decrease by one) the byte at the data pointer.
.   output the byte at the data pointer.
,   accept one byte of input, storing its value in the byte at the data pointer.

Fortunately the remaining commands <>[] (moving data pointer and performing conditional jumps) are not required!
Split into 3 lines for clarity: 1: Increment until the data reaches 32. 2: Output and increment until data reaches 126. 3: Output and decrement until data reaches 32.
++++++++++++++++++++++++++++++++

.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.

.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.

Output
 !"#$%&'()*+,-./0123456789:;<=>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!

Edit N=2
Per @nneonneo's answer, it is possible to replace each + with 255 -signs for N=2. some rearrangement of the code and output (displaying down then up) means the first line can be reduced to 256-126=130 - signs. This occurred to me after I went to bed, and nneoneo beat me to it. https://codegolf.stackexchange.com/a/35801/15599

Yes, you can use ~ instead of ~~ since the increasing and decreasing subsequences would still be there.

There had to be a Brainfuck program somewhere for this question ;)

beat me to it....

C; N = 43 = 40 + 3
Here I avoid such common characters as + - * /, the digits 0-9, comma , and semicolon ;.
So I was forced to express various numbers using only the operations & % ~.
Further golfing may be possible (finding smallest representations for the numbers 63 and 95 is an exercise for the reader).
main(){
if (printf(" !"))
if (putchar('"'))
if (printf("#$%%&'"))
if (putchar('i'%(~' '&'a')))
if (putchar('j'%(~' '&'a')))
if (putchar('k'%(~' '&'a')))
if (putchar('l'%(~' '&'a')))
if (putchar('m'%(~' '&'a')))
if (putchar('n'%(~' '&'a')))
if (putchar('o'%(~' '&'a')))
if (putchar('p'%(~' '&'a')))
if (putchar('q'%(~' '&'a')))
if (putchar('r'%(~' '&'a')))
if (putchar('s'%(~' '&'a')))
if (putchar('t'%(~' '&'a')))
if (putchar('u'%(~' '&'a')))
if (putchar('v'%(~' '&'a')))
if (putchar('w'%(~' '&'a')))
if (putchar('x'%(~' '&'a')))
if (putchar('y'%(~' '&'a')))
if (putchar('z'%(~' '&'a')))
if (putchar('{'%(~' '&'a')))
if (putchar('|'%(~' '&'a')))
if (putchar('}'%(~' '&'a')))
if (putchar('~'%(~' '&'a')))
if (putchar('~'%(~'!'&'a')))
if (putchar(~(~('~'%(~'!'&'a'))&~(~' ' & '!'))))
if (putchar(~'!'&'a'))
if (putchar(~' '&'a'))
if (putchar(~' '&'b'))
if (putchar(~' '&'c'))
if (putchar(~' '&'d'))
if (putchar(~' '&'e'))
if (putchar(~' '&'f'))
if (putchar(~' '&'g'))
if (putchar(~' '&'h'))
if (putchar(~' '&'i'))
if (putchar(~' '&'j'))
if (putchar(~' '&'k'))
if (putchar(~' '&'l'))
if (putchar(~' '&'m'))
if (putchar(~' '&'n'))
if (putchar(~' '&'o'))
if (putchar(~' '&'p'))
if (putchar(~' '&'q'))
if (putchar(~' '&'r'))
if (putchar(~' '&'s'))
if (putchar(~' '&'t'))
if (putchar(~' '&'u'))
if (putchar(~' '&'v'))
if (putchar(~' '&'w'))
if (putchar(~' '&'x'))
if (putchar(~' '&'y'))
if (putchar(~' '&'z'))
if (putchar(~' '&'{'))
if (putchar(~' '&'|'))
if (putchar(~' '&'}'))
if (putchar(~' '&'~'))
if (putchar(~(~(~' '&'~')&~(~' ' & '!'))))
if (putchar(~('!'%' ')&'a'))
if (printf("abcdefghijklmnopqrstuvwxyz{|}~}|{zyxwvutsrqponmlkjihgfedcba"))
if (putchar(~('!'%' ')&'a'))
if (putchar(~(~(~' '&'~')&~(~' ' & '!'))))
if (putchar(~' '&'~'))
if (putchar(~' '&'}'))
if (putchar(~' '&'|'))
if (putchar(~' '&'{'))
if (putchar(~' '&'z'))
if (putchar(~' '&'y'))
if (putchar(~' '&'x'))
if (putchar(~' '&'w'))
if (putchar(~' '&'v'))
if (putchar(~' '&'u'))
if (putchar(~' '&'t'))
if (putchar(~' '&'s'))
if (putchar(~' '&'r'))
if (putchar(~' '&'q'))
if (putchar(~' '&'p'))
if (putchar(~' '&'o'))
if (putchar(~' '&'n'))
if (putchar(~' '&'m'))
if (putchar(~' '&'l'))
if (putchar(~' '&'k'))
if (putchar(~' '&'j'))
if (putchar(~' '&'i'))
if (putchar(~' '&'h'))
if (putchar(~' '&'g'))
if (putchar(~' '&'f'))
if (putchar(~' '&'e'))
if (putchar(~' '&'d'))
if (putchar(~' '&'c'))
if (putchar(~' '&'b'))
if (putchar(~' '&'a'))
if (putchar(~'!'&'a'))
if (putchar(~(~('~'%(~'!'&'a'))&~(~' ' & '!'))))
if (putchar('~'%(~'!'&'a')))
if (putchar('~'%(~' '&'a')))
if (putchar('}'%(~' '&'a')))
if (putchar('|'%(~' '&'a')))
if (putchar('{'%(~' '&'a')))
if (putchar('z'%(~' '&'a')))
if (putchar('y'%(~' '&'a')))
if (putchar('x'%(~' '&'a')))
if (putchar('w'%(~' '&'a')))
if (putchar('v'%(~' '&'a')))
if (putchar('u'%(~' '&'a')))
if (putchar('t'%(~' '&'a')))
if (putchar('s'%(~' '&'a')))
if (putchar('r'%(~' '&'a')))
if (putchar('q'%(~' '&'a')))
if (putchar('p'%(~' '&'a')))
if (putchar('o'%(~' '&'a')))
if (putchar('n'%(~' '&'a')))
if (putchar('m'%(~' '&'a')))
if (putchar('l'%(~' '&'a')))
if (putchar('k'%(~' '&'a')))
if (putchar('j'%(~' '&'a')))
if (putchar('i'%(~' '&'a')))
if (printf("'&%%$#"))
if (putchar('"'))
if (printf("! "))
{}
}

The ascii subset is 32...41 and 97...126.
I am not sure whether newline characters are allowed in code; if not, just remove them.

Newlines are not allowed but as you can remove them in C it's not an issue here.

Nice. Should be the minimum N for a C solution outside of abusing the linker - that whole main() thing...

Whirl, N=2, 6486 bytes
Using only 2 characters, 01.
[encoded data, 6486 characters]

Output :
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!

I think I can golf down more using loops, but coding with 0s and 1s was horrible, so I won't do it.
Commented
00011000001111 // init math.val to O
0000100000100000100000100000100000100000100000100000100000100 // math.val to 32, mem to 32
110000 // set IO to print
0111001111000100000001111100000100 // print ascii(32), mem to 33
01001111000100000001111100000100 // print ascii(33), mem to 34
01001111000100000001111100000100 // print ascii(34), mem to 35
01001111000100000001111100000100 // print ascii(35), mem to 36
                                 // skipped
01001111000100000001111100000100 // print ascii(l23), mem to l24
01001111000100000001111100000100 // print ascii(l24), mem to l25
01001111000100000001111100000100 // print ascii(l25), mem to l26
0100 // print ascii(l26)
111100010000000100001111000001000100 // mem to l25, print ascii(l25)
111100010000000100001111000001000100 // mem to l24, print ascii(l24)
111100010000000100001111000001000100 // mem to l23, print ascii(l23)
                                     // skipped
111100010000000100001111000001000100 // mem to 34, print ascii(34)
111100010000000100001111000001000100 // mem to 33, print ascii(33)
111100010000000100001111000001000100 // mem to 32, print ascii(32)
0001100 // KTHXBAI

Note that there's O and l as 0 and 1.

C; N = 61 = 58 + 3
To compensate for using such a large subset, I golfed my code.
a;main(d){for(;d&&++a,d||--a;putchar(a+31),a-95||--d);}

The ASCII subset is 32...59 and 97...126.
It was a fun challenge to avoid the = character!

Oh, nice, though anatolyg's answer cleverly manages to avoid ;. You might be able to use that to expand your answer, without it becoming a copy of the other one.

No......... ;-)

Python 2.7 N=45=42+3
This uses string.printable, sorts and spits it out over stdout. I save a few characters by inserting the . in stdout.write by using eval and string formating using the ord values of characters I could use.
from string import printable
from sys import stdout
eval("map(stdout%swrite,sorted(printable,None,ord))"%chr(ord('+') + ord('z')-ord('w') ))
print ""
eval("map(stdout%swrite,reversed(sorted(printable,None,ord)))"%chr(ord('+') + ord('z')-ord('w') ))

Out with the old - N=49=46+3
Unfortunately, while python includes the string.printable list, this isn't in ascii order, and there is no way to use it without a * or a ., so it takes less characters to do it manually.
Using the character range:
abcdefghijklmnopqrstuvwxyz{|}~ AND   !"#$%&'()*+,-.

print ''.join((chr(i)
  for i in range(
    len('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'),
    len('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
  )))
print ''.join((chr(i)
  for i in range(
    len('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'),
    len('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'),
    -len('x')
  )))

The obvious version: N=63=60+3
This is the obvious version using the character range:
[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   AND   !"#$%&'()*+,-./01234567 `:

print ''.join([chr(i) for i in range(0x20,0x7E)])
print ''.join(reversed([chr(i) for i in range(0x20,0x7E)]))

A bit nitpicky comment, but you didn't include 1 in your first character range. You got me wondering for a while why would you need a 0.

@Dunno Thanks for pointing it out, but I dunno why I even used a 1 when len('x') saves me another 2 characters.

I've just realized that your code uses newlines. This is not allowed since they aren't printable ascii.

@Calvin'sHobbies Sadly python isn't very golf friendly, I'll see what I can do.

It looks like your import solution will only work if you have ;, which adds a substantial amount of characters.

@Gabe I could pull the same ord/chr/eval trick and get it done, I just haven't had time to figure that out.

Python 2.7 N=28+12+3=43
Using characters cdefghijklmnopqrstuvwxyz{|}~ and then wrapping around to  !"#$%&'()*+
exec "print ''"
   + chr(ord('+') + len('xxx'))        # .
   + "join(chr(i) for i in r"
   + chr(ord('c') + ~len('x'))         # a
   + "nge(ord(' ')"                    # 32
   + chr(ord('+') + len('x'))          # ,
   + " ord('~') + len('x'))) + ''"     # 127
   + chr(ord('+') + len('xxx'))        # .
   + "join(chr(i) for i in r"
   + chr(ord('c') + ~len('x'))         # a
   + "nge(ord('~')"                    # 126
   + chr(ord('+') + len('x'))          # ,
   + " ord(' ') + ~len('')"            # 31
   + chr(ord('+') + len('x'))          # ,
   + " + ~len('')))"                   # -1

In order to avoid using ,.- I had to use some tricks. I used exec so I can make the code into strings which allowed me to use chr(ord('+') + len('xxx')) for . and chr(ord('+') + len('x')) for ,. Any place I needed a -1, I used ~0 in the form of ~len(''). To avoid a, I used chr(ord('c') + ~len('x')) (99 - 2).
The string that gets composed has N=48, using characters abcdefghijklmnopqrstuvwxyz{|}~ and then wrapping around to  !"#$%&'()*+,-.
print ''.join(chr(i) for i in range(ord(' '), ord('~') + len('x')))
    + ''.join(chr(i) for i in range(ord('~'), ord(' ') + ~len(''), + ~len('')))

Note that the newlines and comments are only for readability.

Ruby - N=48
Let Ruby be Ruby and embrace the wrap-around penalty.

N=48 <- 15 (' '-'.') + 30 ('a'-'~') + 3
eval "for c in ' '..'~' do putc c end #{('i'.ord-'.'.ord).chr} for c in ' '..'~' do putc ('~'.ord+' '.ord-c.ord).chr end"

or
eval "(' '..'~').each { |c| putc c } #{('i'.ord-'.'.ord).chr} (' '..'~').each { |c| putc ('~'.ord+' '.ord-c.ord).chr }"

Old:

N=72 {straight-line scoring} <- 72 ('.'-'u') + invalid newlines
format = 67.chr
format << 42.chr
a = []
for i in 33..126 do a << i end
t = a.dup
for i in 33..126 do a << t.pop end
puts a.pack format

There's some flailing in here to avoid the 'v' in "reverse". I left it in because I'm fond of the pack("C*") hack.

Zsh, N = 22 + 2 + 3 = 27
print {~..!} {!..~}

Try it online!
print turns out to be the most forgiving way to output for this challenge; echo has a "c", and <<< ends up too far away too (not to mention brace expansions aren't expanded with it).
As for why I used ! instead of  :
print {~.. } { ..~}      # would save a point, but doesn't work
print {~..\ } {\ ..~}    # works, but costs 13 points compared to "!"
print {~..' '} {' '..~}  # works, but costs  6 points compared to "!"
print {~.." "} {" "..~}  # works, but costs  1 point  compared to "!"

Instead, we rely on print joining the arguments with spaces to get the middle space.

x86_64 Machine Code, Mach-O format
N = 2, 32768 chars (too large to fit msg limit)
Edit:
Pastebin is down, so you can find the full text at: http://www.ionoclast.com/random/golf.bin.txt

Is your entire code available somewhere? If not, you could post the full code externally; for example, on http://pastebin.com.

The compiled executable is 33455 bits or bytes? You don't usually have an odd number of bits, and Clang and GCC won't produce such small executables without some tricks to strip the exception table. This program compiles to 8520 bytes, including the unwind table: `#include <unistd.h>
int main() {
char const s[] = "~}|{zyxwvutsrqponmlkjihgfedcba`^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+)('&%$#"! !"#$%&'()+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^`abcdefghijklmnopqrstuvwxyz{|}~";
write( 1, s, sizeof s );
}
` Assembly should do a lot better.

Actually, it was exactly 4k == 32768 binary characters. I think I found a bug in SO's char counting code.

Ruby, N = 27
Uses $ through >.
$><<(''<<32<<33<<34<<35<<36<<37<<38<<39<<40<<41<<42<<43<<44<<45<<46<<47<<48<<49<<50<<51<<52<<53<<54<<55<<56<<57<<58<<59<<60<<61<<62<<63<<64<<65<<66<<67<<68<<69<<70<<71<<72<<73<<74<<75<<76<<77<<78<<79<<80<<81<<82<<83<<84<<85<<86<<87<<88<<89<<90<<91<<92<<93<<94<<95<<96<<97<<98<<99<<100<<101<<102<<103<<104<<105<<106<<107<<108<<109<<110<<111<<112<<113<<114<<115<<116<<117<<118<<119<<120<<121<<122<<123<<124<<125<<126<<126<<125<<124<<123<<122<<121<<120<<119<<118<<117<<116<<115<<114<<113<<112<<111<<110<<109<<108<<107<<106<<105<<104<<103<<102<<101<<100<<99<<98<<97<<96<<95<<94<<93<<92<<91<<90<<89<<88<<87<<86<<85<<84<<83<<82<<81<<80<<79<<78<<77<<76<<75<<74<<73<<72<<71<<70<<69<<68<<67<<66<<65<<64<<63<<62<<61<<60<<59<<58<<57<<56<<55<<54<<53<<52<<51<<50<<49<<48<<47<<46<<45<<44<<43<<42<<41<<40<<39<<38<<37<<36<<35<<34<<33<<32)

Scala, N = 69
\u0028\u0027\u0020\u0027\u0074\u006f\u0027\u007e\u0027\u0029\u002b\u002b\u0028\u0027\u007e\u0027\u0074\u006f\u0027\u0020\u0027\u0029

Uses the characters 01246789\bdefu (unicode escapes) as a fancy way of writing (' 'to'~')++('~'to' ')map print.

Lenguage, N=1, 1051031305378170472802141990371710130229567839916356530545925757126045319904479746110699524004618985593156618424109188625672742261101447765479880468512170844090412908982576756544352839464930752275112743890775461636401594361137373794023488860005007435006520443129620535092091787646449862714370596024435599036073543700063989003712012285691090357581157986517772 bytes
                    ...1051031305378170472802141990371710130229567839916356530545925757126045319904479746110699524004618985593156618424109188625672742261101447765479880468512170844090412908982576756544352839464930752275112743890775461636401594361137373794023488860005007435006520443129620535092091787646449862714370596024435599036073543700063989003712012285691090357581157986517732 spaces omitted...
This gets converted to the brainf*** program ++++[->++++++++<]>.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. using the method described here, which outputs  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! .

How is this any improvement on this answer?

It isn't. I just thought I'd post this for fun.

Thunno J, n=25, 21 bytes
32+127:C0126+095:-CA+

Attempt This Online!
Uses + (43) to C (67)
Explanation
32           # Push 32
  +          # Add this to 0 (this is just so that we have
             # a separator between the numbers - usually
             # we use a space but that's too far away)
   127       # Push 127
      :      # Get the range between 32 and 127
       C     # Convert each to a character from a charcode
        0    # Push 0
         126 # Push 126
+            # Add them together (acts as a separator again)
 0           # Push 0
  95         # Push 95
    :        # Get the range between 0 and 95
     -       # Subtract each from 126
      C      # Convert each to a character from a charcode
       A+    # Concatenate the two lists
             # J flag joins into a single string
             # Implicit output

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Crop an image to a square
In this challenge, you will take an input image and crop it to make a square, leaving only the central part of the input image.
The answers must work with landscape, portrait, or square input images. The width of the output image should be equal to the shortest side of the input image e.g. the result of a 200x300 image should be a 200x200 image. An equal amount must be cropped from both ends of the input image e.g. for a 200x300 input image, 50 pixels should be cropped from each end of the image, leaving only the central part of the image. Where its not possible to crop an equal amount from both sides e.g. a 200x301 image, the extra 1 pixel may be cropped from either end of the image. For a square input image, the output should be identical to the input.
Input:
The input file should be read from the hard disk of the machine running the program. You may choose which of bmp, jpeg, png or pnm to support as the input image format.
Output
The output file should be written to the hard disk of the machine running the program. The format of the output image should be bmp, jpeg, png or pnm.
Win Criteria
This is code golf. Shortest code wins.
Notes:

The input/output file paths do not count towards the program size.
The standard libraries of your programming language may be used. Other libraries are disallowed.
Standard loopholes apply.

Example:
Input Image:

Expected Output:

Images by kirill777 - licenced CC-BY 3.0

This seems to have a significant bias toward languages whose standard library contains BMP functions. For example, http://php.net/manual/en/function.imagecreatefromwbmp.php

Thats true but allowing external libraries would bring its own set of potential issues and introduce too much scope for loopholes

Can we at least choose the image format?

@doorknob i updated the question to allow jpeg and png. If anyone wants to use another format, please request it in the comments.

PNM? That allows languages with no standard library support for images to participate.

@PeterTaylor added. thanks

Parsing the raw bytestream: Haskell (319 = 332 - 13)
Without any imports at all, this program crops P1 PBM images.

g _[]=[]
g z x=(\(a,b)->a:g z b).splitAt z$x
q=map
f=filter
main=do c<-readFile"in.pbm";let(r:p)=tail.f((/='#').head).lines$c;(w:h:_)=(q read).words$r;m=min w h;t s=take m.drop((s-m)`div`2);k d=[[m,m]]++(q(t w)(t h d))in writeFile"out.pbm".("P1\n"++).unlines.q(unwords.(q show)).k.(q((q read).g 1)).take h.g w.f(`elem`"01").concat$p

Special case: helpful formatting (214 = 227 - 13)
My first attempt at PBM (P1) was based on the example at Wikipedia and assumed spaces separated the pixels, and lines in the text correlated with lines in the image. Under those conditions, this shorter version works fine.

main=do c<-readFile"in.pbm";writeFile"out.pbm".("P1\n"++).unlines.q(unwords.(q show)).k.q((q read).words).tail.filter((/='#').head).lines$c
k((w:h:_):d)=let m=min w h;t s=take m.drop((s-m)`div`2)in[[m,m]]++(q(t w)(t h d))
q=map

Bonus feature: strips out comments!
Both of the above work in essentially the same manner as the original below, but with a simpler header, lower bit depth, and no padding, although the topmost program works harder to allow for a range of formatting options.
Also available in a wide range of colours: Haskell (545 = 558 - 13)
No pre-existing image-handling functions were harmed in the making of this program.
Uncompressed 24-bit RGB bitmaps have a fairly straight-forward header system but are complicated by the mod-4 padding for each row's byte array. This code grabs the bitmap offset, width, and height from the input header, calculates the row padding, and extracts the bitmap data into a list of lists (rows of columns, bottom-left corner first).
Cropping is as simple as dropping half the excess and then taking the desired length from each list. The new file size is calculated as 3*(padded width)*height + 54 bytes (for the minimal required headers). The new header is constructed and the cropped image data appended. It's all mapped to characters and written back out to disk.
Input: in.bmp (6 characters removed from total)
Output: out.bmp (7 characters removed from total)
I think there's still some redundancy still in there, but my brain hurts to look at it this way.

import System.IO
import Data.Char
import Data.List.Split
main=do k"in.bmp"ReadMode(\h->do i h u;c<-hGetContents h;let d=l(ord)c;w=s 18d;h=s 22d;p=o w;m=min w h;q=o m;j a b=y a(r b m)in k"out.bmp"WriteMode(\g->do i g u;hPutStr g$"BM"++l chr((z e[m*(3*m+q)+54,0,54,40,m,m,1572865,0,0,1,1,0,0])++((z((++(f q$cycle[0])).y(3*m)(3*r w m)).j m h$chunksOf(3*w+p)$n(s 10d)d)))))
i=hSetBinaryMode
k=withFile
z=concatMap
l=map
v=div
f=take
n=drop
u=True
y t d=f t.n d
s d=sum.zipWith(*)(l(256^)[0..3]).y 4d
o=(`mod`4)
r a b=v(a-b)2
e x=l((`mod`256).(x`v`).(256^))[0..3]

For comparison, an ungolfed version is over 8 times as long, at 4582 (4595 - 13) bytes:

import System.IO
import Data.Char
import Data.List.Split

main = readImage cropImageToSquare

cropImageToSquare fileHandle = do

  hSetBinaryMode fileHandle True
  fileContents <- hGetContents fileHandle

  let
    inImageData         = asBytes fileContents

    inImageBitmapOffset = getIntFromWordAt 10 inImageData
    inImageWidth        = getIntFromWordAt 18 inImageData
    inImageHeight       = getIntFromWordAt 22 inImageData

    inImageBitmapData   = drop inImageBitmapOffset inImageData
    inImageBitmap       = chunksOf (paddedBytesForWidth inImageWidth) inImageBitmapData

    outImageSideLength  = min inImageWidth inImageHeight

    outFileHeader       = fileHeader  outImageSideLength outImageSideLength
    outImageHeader      = imageHeader outImageSideLength outImageSideLength
    outHeaders          = outFileHeader ++ outImageHeader

    outImageBitmap      = crop outImageSideLength outImageSideLength inImageWidth inImageBitmap

    in
      writeImage "out.bmp" outHeaders outImageBitmap

--- Read Image ---------------------------------------------------------

readImage = withFile "in.bmp" ReadMode

--------------------------------------------------------- Read Image ---

--- Write Image --------------------------------------------------------

writeImage filename header imageBitmap = do
  withFile filename WriteMode write'
    where
      write' fileHandle = do
        hSetBinaryMode fileHandle True
        hPutStr fileHandle . ("BM"++)
                           . map chr $ (concatMap wordFromInt header)
                                     ++ (concat imageBitmap)

-------------------------------------------------------- Write Image ---

--- Character-Integer Conversion ---------------------------------------

asBytes = map ord

getWordAt offset = take 4 . drop offset

getIntFromWordAt offset = intFromWord . getWordAt offset

intFromWord     = sum . zipWith (*) (map (256^) [0..3])

wordFromInt int = map((`mod` 256) . (int `div`) . (256^)) [0..3]

--------------------------------------- Character-Integer Conversion ---

--- Headers ------------------------------------------------------------

fileHeader width height = [ fileSize
                          , reserved
                          , bitmapOffset
                          ]
  where
    fileSize     = imageFileSize width height
    reserved     = 0
    bitmapOffset = 54

imageFileSize width height = 54 + height * (paddedBytesForWidth width)
paddedBytesForWidth width  = 3 * width + rowPadding width
rowPadding = (`mod` 4)

imageHeader width height = [ imageHeaderSize
                           , width
                           , height
                           , planesAndBits
                           , compression
                           , bitmapSize
                           , horizontalImageResolution
                           , verticalImageResolution
                           , paletteSize
                           , coloursUsed
                           ]
  where
    imageHeaderSize  = 40
    planesAndBits    = int32FromInt16s colourPlanes bitDepth
    colourPlanes     = 1
    bitDepth         = 24
    compression      = 0
    bitmapSize       = 0
    horizontalImageResolution = pixelsPerMetreFromDPI 72
    verticalImageResolution   = pixelsPerMetreFromDPI 72
    paletteSize      = 0
    coloursUsed      = 0

pixelsPerMetreFromDPI = round . (* (100/2.54))

int32FromInt16s lowBytes highBytes = lowBytes + shift 2 highBytes
shift bytesUp number  = (256 ^ bytesUp) * number

------------------------------------------------------------ Headers ---

--- Crop Image ---------------------------------------------------------

crop toHeight toWidth fromWidth = cropWidth toWidth fromWidth
                                . cropHeight toHeight

cropHeight toHeight image = take toHeight
                          . drop ( halfExtra (length image) toHeight)
                          $ image

cropWidth toWidth fromWidth image = map ( padRow toWidth
                                        . take (3 * toWidth)
                                        . drop (3 * (halfExtra fromWidth toWidth))
                                        )
                                      $ image

padRow toWidth xs = take (paddedBytesForWidth toWidth)
                      $ xs ++ (repeat 0)

halfExtra fromLength toLength = (fromLength - toLength) `div` 2

--------------------------------------------------------- Crop Image ---

Very nice answer. I'm having a little trouble getting it to work with my test images. see https://dl.dropboxusercontent.com/u/141246873/crop/bg1ascii.pbm and https://dl.dropboxusercontent.com/u/141246873/crop/bg1raw.pbm These images are pbm versions of the example image in the question. They were generated using GIMP. One is ascii and the other is raw. Please could you try it with either one of the files. Thanks.

On the first version, some characters can be saved by shortcutting map to an infix function (like (#)=map) instead of q. Maybe on the second version too, i haven't checked.

P4 PBMs are out, sorry. As for the P1 image, I followed the Wikipedia example too closely and assumed spaces between pixels and matching line lengths. The new (longer) program I just added handles bg1ascii.pbm, though, and still manages it without importing functionality.

Tested and its working well with the GIMP generated images

Rebol, 165  92 (105 - 13)
i: load %in.bmp
s: i/size
m: min s/1 s/2
c: to-pair reduce[m m]save %out.bmp copy/part skip i s - c / 2 c

At its simplest if you have a image file (in.bmp) of 300x200 then it can be cropped and saved to file (out.bmp) like so:
save %out.bmp copy/part skip load %in.bmp 50x0 200x200

Rebol comes with a spatial coordinates datatype called Pair!  Here are some examples of this datatype (using Rebol console):
>> type? 300x200
== pair!

>> first 300x200
== 300.0

>> second 300x200
== 200.0

>> 300x200 - 200x200
== 100x0

>> 300x200 - 200x200 / 2
== 50x0

The last example shows how the skip coordinates were worked out for balanced cropping.

NB. This solution was tested using latest version of Rebol 3 (see http://rebolsource.net/) on OS X.  BMP is currently supported on all platforms.  PNG, Jpeg & other formats are only partially implemented (across platforms) at this time.

 Mathematica 52
Spaces not needed:
ImageCrop[#, {#, #} &@Min@ImageDimensions@#] &@Import@"c:\\test.png"

Sorry this is one of the standard loopholes: http://meta.codegolf.stackexchange.com/a/1078/21713

@Ryan Sorry, but not this time. The OP (you) wrote "The standard libraries of your programming language may be used. Other libraries are disallowed.".I'm using only the standard Mathematica statements - NO LIBRARIES AT ALL

Bash, 115
with ImageMagic, hard to say if you can count it as a standard lib :)
#!/bin/bash
convert $1 -set option:size '%[fx:min(h,w)]x%[fx:min(h,w)]' xc:red +swap -gravity center -composite _$1

I'm not counting it as a standard lib sorry :)

Java, 373 348 342 336 322
import java.awt.image.*;import java.io.*;import javax.imageio.*;class M{public static void main(String[]a)throws Exception{BufferedImage i=ImageIO.read(new File(a[0]));int[]d={i.getWidth(),i.getHeight()},o={0,0};int s=d[0]>d[1]?1:0;o[1-s]=(d[1-s]-d[s])/2;ImageIO.write(i.getSubimage(o[0],o[1],d[s],d[s]),"bmp",new File("out.bmp"));}}

Ungolfed:
import java.awt.image.*;
import java.io.*;

import javax.imageio.*;

class M{
    public static void main(String[] args) throws Exception{
        // read file as argument, instead of args[0] the path to the file could hardcoded.
        // Since the path to the input file don't count towards the character count, I'm not counting args[0]
        BufferedImage i = ImageIO.read(new File(args[0]));

        int[] dimension = { i.getWidth(), i.getHeight() }, origin = { 0, 0 };

        int smaller = dimension[0] > dimension[1] ? 1 : 0;

        // 1-smaller is the index of the bigger dimension
        origin[1-smaller] = (dimension[1-smaller] - dimension[smaller]) / 2;

        // again, path to output file don't count
        ImageIO.write(i.getSubimage(origin[0], origin[1], dimension[smaller], dimension[smaller]), "bmp", new File("out.bmp"));
    }
}

Usage: java M image.type
Should be able to read jpg, png, bmp, wbmp and gif. Writes a bmp called "o".
Who said you couldn't use Java for golf?
Edit: Just realised that file paths don't count towards the character count.

You can use * for imports.. Like import java.io.* etc ;)

I'm so used to eclipse handling the imports that I didn't even think of that. There was other stuff that could be removed, too. E: Oops, forgot an import.

You can cut 9 by removing public  from the class and the two spaces in String[] a) throws. You should add a golfed (no whitespace) version so it's easier for others to count/verify, though.

@Geobits done. Also apparently I counted too many characters. Should be fixed now.

Works nicely for portrait/landscape images but doesn't seem to produce any output for square images?

@Ryan Yes it does. Also I can't see why it would work for portrait but not square as it's exactly the same code that runs.

@IchBinKeinBaum please ignore my comment. I just tried it with this one and it worked: https://dl.dropboxusercontent.com/u/141246873/crop/bg31.jpg not sure what the difference is between this one and the other

C# - 250 271 265 229 (incl. 26 for file names)
Forgot about the import for it to work.
using System.Drawing;
class P{static void Main(string[] a){var b=new Bitmap(@"C:\Dev\q.jpg",true);int h=b.Height,w=b.Width,s=h<w?h:w,d=(h-w)/2;b.Clone(new Rectangle(d>0?0:d*-1,d>0?d:0,s,s),b.PixelFormat).Save(@"C:\Dev\q2.jpg");}}

De-golfed (or what you call it).
using System.Drawing;
class Program
{
static void Main(string[] a)
{
var b = new Bitmap(@"C:\Dev\q.jpg",true);
int h=b.Heightw=b.Width,s=h<w?h:w,d=(h-w)/2;
b.Clone(new Rectangle(d>0?0:d*-1,d>0?d:0,s,s),b.PixelFormat).Save(@"C:\Dev\q2.jpg");
}
}

Thanks (again) to w0lf for pointing out different declaration style.

this can be reduced significantly by erasing extra whitespace and using the int x=..., y=... declaration style: http://pastie.org/9454985

also, you can drop the spaces around equal signs and most line breaks. See the link in my previous comment. It's 232 chars.

Thanks! I guess it is better to actually look at the link :)

Yes. Well, at both links because I just realized thsi can be shortened even more. :)

Well, according to the rules the image-reference don't count, but yeah, nice!

You are right! I had not seen that rule. Then, just the Bitmap -> var improvement counts.

Ah, ofcourse! I had changed from var to int on the other values since it didn't matter :)

C#, 420
If the image is portrait it gets rotated while cropping and then cropped image is rotated to correct orientation.
Edit: now crop centre of the image. Run in terminal as crop.exe a.jpg
class P
{
static void Main(string[] a)
{
if (a.Length > 0)
{
Bitmap b = (Bitmap)Image.FromFile(a[0]);
int w = b.Width;
int h = b.Height;
int d = Math.Abs(w - h) / 2;
if (h > w) { b.RotateFlip(RotateFlipType.Rotate270FlipNone); }
Bitmap c = new Bitmap(h, h);
for (int x = d; x < (h+d); x++)
{
for (int y = 0; y < h; y++)
{
c.SetPixel(x-d, y, b.GetPixel(x, y));
}
}
if (h > w) { c.RotateFlip(RotateFlipType.Rotate90FlipNone); }
c.Save("Q.jpg");
}
}
}

Unfortunately this throws an exception on an image with portrait orientation. It also outputs the left side of the input image and not the central part. To see what I mean, try it with the example image in the question and compare your result.

Clojure, 320 (333 - 13 for filenames)
Deciding to sidestep types, this P1 (ASCII) PBM cropper is written in Clojure.
With function names like interpose, read-string, and clojure.string/replace, it's not exactly golf friendly, and I'm not sufficiently experienced to know if I can compile without a namespace declaration. (Leiningen puts it in automatically, and Leiningen is nice to me, so I'm going to leave it there, though I did eject .core.) On the plus side, however, file access and string concatenation are short.

(ns a(:gen-class))(defn -main[](let[[[_ r p]](re-seq
#"(^\s*\d+\s+\d+)([\s\S]*$)"(clojure.string/replace(slurp"in.pbm")#"(P1)|(#.*\n)"""))[w
h](map read-string(re-seq #"\d+"r))c(min w h)](spit"out.pbm"(apply
str"P1\n"c" "c"\n"(flatten(interpose"\n"(take
c(partition c w(drop(+(*(quot(- h c)2)w)(quot(- w c)2))(re-seq #"\S"p))))))))))

The function at the heart of the program is ungolfed below.

(defn crop-pbm [in out]
  (let [         filestream (slurp in)
                 image-data (clojure.string/replace (str filestream "\n") #"(P1)|(#.*\n)" "")
    [[_ resolution pixels]] (re-seq #"(^\s*\d+\s+\d+)([\s\S]*$)" image-data)
                     pixels (re-seq #"\S" pixels)
             [width height] (map read-string (re-seq #"\d+" resolution))
                       crop (min width height)
                 drop-width (- width  crop)
                drop-height (- height crop)
         initial-drop-width (quot drop-width  2)
        initial-drop-height (quot drop-height 2)
               initial-drop (+ (* initial-drop-height width) initial-drop-width)
             cropped-pixels (take crop
                                  (partition crop width
                                             (drop initial-drop pixels)))
              cropped-image (apply str "P1\n" crop " " crop "\n"
                                       (flatten (interpose "\n" cropped-pixels)))]
      (spit out cropped-image)))

Rather than constructing a two-dimensional array to represent the image, this program calculates the number of pixels to the new top-left corner and drops them, then jumps original-width pixels at a time, taking cropped-side-length pixels from as many steps.
The regular expression function re-seq does much of the heavy lifting, stripping out whitespace and forming arrays simultaneously, which leads me to suspect that Perl could follow this approach and yield a shorter program.

Perl, 276 287 (289 300 - 13)
Regex to the Rescue!
Who needs dedicated image functions when you have regular expressions? (And 1-bit images to crop.)
local$/;open I,"in.pbm";$_=<I>;s/(P1)|(#.*\n)//g;/^\s*(\d+)\s+(\d+)([\s\S]*)$/;($w,$h,$_)=($1,$2,$3);$c=$w<$h?$w:$h;s/\D//g;$d=$w-$c;while($z++<$w*int(($h-$c)/2)+int($d/2)){s/^\d//};while($i++<$c){/^(\d{$c})(\d{$d})(.*)/;$p.=$1."\n";$_=$3."0"x$w}open O,'>',"out.pbm";print O"P1\n$c $c\n$p"

That's the golfed version of:
use strict;
use warnings;

# Read in the image file
local $/ = undef;

open IMAGEIN, '<', "in.pbm" or die "Can't read 'in.pbm': $!";
my $image_data = <IMAGEIN>;
close IMAGEIN;

# Remove the header and any comments
$_ = $image_data;
s/(P1)|(#.*\n)//g;

# Divide into width, height, and pixels
/^\s*(\d+)\s+(\d+)([\s\S]*)$/;
(my $width, my $height, $_) = ($1, $2, $3);

# Remove anything that isn't a number from the pixel data
s/\D//g;
my $pixels = $_;

# Determine the new dimensions
my $crop = $width < $height ? $width : $height;

# Calculate total to remove along each axis
my $drop_width  = $width  - $crop;
my $drop_height = $height - $crop;

# Calculate how much to remove from the first side along each axis
my $initial_drop_width  = int($drop_width  / 2);
my $initial_drop_height = int($drop_height / 2);

# Calculate total pixels to the new top-left corner
my $initial_drop = $width * $initial_drop_height + $initial_drop_width;

# Remove the pixels preceding the corner
$_ = $pixels;
while (32760 < $initial_drop)  # Stay under regex limit
{
    s/^\d{32760}//;
    $initial_drop -= 32760;
}
s/^\d{$initial_drop}//;

# Take *crop* rows of *crop* pixels
$pixels = "";
for (my $i=0; $i<$crop; $i++)
{
    /^(\d{$crop})(\d{$drop_width})(.*)/;
    $pixels .= $1 . "\n";
    $_ = $3 . "0"x$width;  # Add some 0s to ensure final match
}

# Construct the new, cropped image
my $cropped_image = "P1\n$crop $crop\n$pixels";

# Write out the image file
open IMAGEOUT, '>', "out.pbm" or die "Can't write 'out.pbm': $!";
print IMAGEOUT $cropped_image;
close IMAGEOUT;

There's a limit to the length of a string the substitution functions will handle, which necessitates a bothersome while loop for taller images. Even so, finally under 300!

C++/Qt 146
This might technically break rule #2 as Qt is not part of standard C++.
The first argument will be the input filename and the second will be the output filename.
#include<QtGui>
main(int c,char**v){QApplication a(c,v);QPixmap p(v[1]);int w=p.width(),h=p.height(),m=qMin(w,h);p.copy(w-m,h-m,m,m).save(v[2]);}

This answer is not valid due to the use of a non standard library, but thanks for taking part :)

Io, 103 bytes (excluding file path)
i := Image open("img.png");e := (i width) min(i height);i crop(((i width)-e)/2,((i height)-e)/2,e,e) save("crop.png")

You can use Io for CG!

This can be heavily 'golfed' even further

Matlab, 116 (130 with file names)
Pretty straightforward.
I=imread('a.jpg');[m,n]=size(I);z=min(m,n);c=m<n;r=[1,ceil((m-z)/2)]*~c+c*[ceil((n-z)/2),1];imwrite(imcrop(I,[r,z-1,z-1]),'z.jpg')

APL (dzaima/APL), 66 bytes
i←P5.img p
P5.size←2⍴a←⌊/s←i.sz
P5.draw←{i P5.G.img⍨.5×a-s⋄i.save}

Try it online!

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Create a popular penrose tiling
The recent question about Wang tiles has led me to think that creating Penrose tilings might be an interesting popularity contest.
Background
Wang tiles are tiles that can tile the plane, but only aperiodically (see Fill the Screen with Wang Tiles for a full description). Penrose tiles give the affirmative answer to a famous problem in mathematics: is it possible to have this property with only two tiles?
The tiles
Here are two different pairs of tiles, both known as Penrose tiles:

In the second pair of tiles, the thin rhombus has angles 36 and 144 degrees; the fat rhombus has angles of 72 and 108 degrees.
In either pair, the edges of the tiles must be matched up so that the colored circles continue across an edge between two tiles. The colored circles and nodules are there to enforce the edge-matching rules (do not draw the nodules). These matching rules ensure that the tiling created cannot be periodic.
The goal
The problem is to create a Penrose tiling and output it in some graphical form. The Wikipedia article about Penrose tiles gives some ideas for how to construct them.
Rules:

One of the two pairs of tiles above must be used, or else the third set of 3 Penrose tiles described in the Wikipedia page (The original Penrose tiling P1)
You do not need to draw the nodules on the righthand set (they are usually omitted). I know this isn't much of a rule, but the pictures will be prettier if you don't draw the bumps.
You must fill a rectangular region with at least 20 tiles
As long as the output is recognizably a Penrose tiling, you can take any artistic license you want (e.g. only drawing the colored arcs)

I used the deflation method described on Wikipedia (in my opinion, the easiest method) to produce the following example:

Please include a picture with your submission. Rule 4 allows for a lot of license to be taken, so hopefully there are some interesting takes on the challenge!

The third tiling you mention is The original pentagonal Penrose tiling (P1), correct?

Yes. I omitted it in the writeup because it's not as concise, but it's fine to use for purposes of the challenge. I've edited the text to be more explicit.

Even if there were programming-related criteria to guide voting, I doubt that many people would take them into account; but as is this is certain to work out in practice as an art contest rather than a programming contest, and so doesn't belong here.

Let's see, I think it is already a challenge to make a program that outputs that tiling.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/