23
3
Updates: Time limit removed. You must be able to describe output - see new rule.
A pangram is a sentence that uses every letter in the alphabet at least once, such as:
A perfect pangram uses every letter exactly once.
Consider writing a program that is a perfect pangram, using the 95 printable ASCII characters (hex codes 20 to 7E) as the alphabet:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
Such a program must contain exactly 95 characters, with each printable ASCII character occurring exactly once, but in any order. (Thus there are 95! = 1.03×10148 possibilities.)
Your task is to write this program such that the number of printable ASCII characters printed to stdout is as high as possible (i.e. prolific).
Your score is the number of printable ASCII characters your program outputs (the total amount, not the distinct amount: AABC scores 4 whereas ABC scores 3). The highest score wins.
Details
- The output may contain any characters (including duplicates) but only instances of the 95 printable ASCII characters count towards your score.
- You can use this JSFiddle to count the number of printable ASCII characters in any string.
- If your language does not have stdout use the most appropriate alternative.
- Your program...
- must have finite runtime (the time limit has been removed)
- must have finite output
- may contain comments
- must compile and run without (uncaught) errors
- must not prompt for or require input
- must be time invariant and deterministic
- must not use external libraries
- must not require a network connection
- must not make use of external files
- (you may use the program file itself as long as changing the file name does not alter the program's behavior)
- If this task is impossible is some language that's just too bad.
- You must give your exact output or precisely describe it if it is too large to fit in a post. You do not actually have to run your program. As long as it would run in a finite amount of time on a computer with an unbounded amount of memory it is valid.
Example
This simplistic Python 2 program is a possible solution:
print 9876543210#!"$%&'()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghjklmoqsuvwxyz{|}~
It outputs 9876543210 which contains 10 printable ASCII characters, thus scoring 10.

14As amazingly admirable as alliteration appears, pangrams just pack a powerful punch, as they're quite vexing. – Geobits – 11 years ago
2I just reread the total-not-distinct rule too. I'd skimmed over it earlier, concluding it was obviously a distinct-not-total rule since the alternative would lead to absurd constructions such as printing the letter
asix quadrillion times, where it isn't even possible to obtain an accurate upper limit on character count. Anyway, I'm still proud of my 95, even if it is kind of small. Size isn't everything, you know. – COTO – 11 years agoWhy do you think this task is impossible in HQ9+? – Peter Taylor – 11 years ago
I'm going to try and do this in FORTRAN (so I can make use of the case insensitivity). --- AND scratch that. I need the letter O 4 times: 2 times for the program declaration and 2 times for my loop declaration. – Nzall – 11 years ago
@COTO The problem with that is that is was too easy to get a perfect score, therefore not much of a contest. – Calvin's Hobbies – 11 years ago
@PeterTaylor In the implementations I've seen any character besides
HQ9+throws an error. – Calvin's Hobbies – 11 years ago@Calvin'sHobbies: Indeed. I read the comments after submitting and discovered the shocking truth. ;) – COTO – 11 years ago
I wish tab weren't forbidden to write the program itself... it would make other program than the cryptic ones possible :/ (see my answer)... (I wrote my first golfscript answer, but it fails on that rule) – Olivier Dulac – 11 years ago
@OlivierDulac Then what would stop you from making a string of arbitrarily many tabs and printing it? 95 characters only. – Calvin's Hobbies – 11 years ago
I wonder why you allowed comments in the program? – GreenAsJade – 11 years ago
@GreenAsJade Why not? It would be a lot harder if not impossible in many languages without allowing them. And the better answers will presumably use as much real code as possible, not waste characters in comments. – Calvin's Hobbies – 11 years ago
At first I thought this was impossible. Now I see the proliferation of answers, it strikes me that being allowed comments is cheating :) – GreenAsJade – 11 years ago
Are there any limits on the CPU register size? – Dennis – 11 years ago
1@Dennis No. 5more – Calvin's Hobbies – 11 years ago