# Pangram "Hello, World!"

Your challenge: The code must print "Hello, World!" and nothing else.

1. The program must be a pangram.

• It must use every character in printable ASCII, or, if you chose a particularly strange language, characters which are stored as one byte.
• You are allowed to use other characters.
2. The program may not have unnecessary characters.

• No subset of individual characters may be removed from the program while the program still outputs "Hello, World!"
• For example, if code ABBC outputs Hello, World! then neither codes AC nor BC may output "Hello, World!", although code BA may.
• This also means you cannot have a statement to print "Hello, World!" per se anywhere in your program, as everything other than that statement could be deleted and the program would do the same thing.
3. The program must not take input.

4. Your program does not create any errors.

5. You must not use any "Hello, World!" builtins.

Your score: Your score is calculated by [length of the program in characters] - [number of different characters]. Lowest score wins. (Tie-breakers are oldest post.)

Nota Bene: the second requirement is almost impossible to verify, so an answer is valid only after a week has passed for anyone who wishes to do so to be able to disprove the validity of your answer.

• Welcome to CGCC! Interesting first challenge. For the ABBC example, would a more comprehensive list of restricted programs be ABB, ABC, BBC, AB, BB, BC, AC, A, B, and C?
– Jo King
Feb 25 at 2:20
• Related: Biggest Irreducible Hello World, which shares the "Hello World!" and irreducible code restriction. Feb 25 at 2:22
• Given that this is still fairly new, I’d suggest changing the string to something like Greetings, World! to avoid Hello World builtins Feb 25 at 4:15
• Next time, maybe try the Sandbox. Feb 25 at 4:21
• @Hyperbole That's an unobservable requirement, I'd recommend against it. Feb 25 at 16:52

# Husk, 256 bytes, 256 characters, score=0

m←C₁†ȯ→*2c¨abqnpsyhkzjwf
¢"H½↕↑↓↔∟¦¡¿‼…‰‡√≤≥±∂∫∞≈≠≡⌐¬÷×τ►#$%&'()+Φ-./013456789:;<=>?@ABDEFG¤IJKLMNOPQRSTUVṄXYZ[\]^_⁵ı§χituvxg¹{|}~·₀₂₃₄₅₆₇₈₉⌈⌉⌊⌋ΓΔΘΛΞΠΣ€ΨΩαβγδεζηθλμξπρςσ▲φƒψω⁰r²³⁴d⁶⁷⁸⁹£,¥o´ ▼!◄lȦḂĊḊĖḞĠḢİĿṀWȮṖṘṠṪẆẊẎŻȧḃċḋėḟġḣeȷŀṁṅṗṙṡṫẇẋẏżÄËÏÖÜŸØäëïöüÿø◊□¶«»  Try it online! I think this is irreducible. It certainly took a bit of effort to build, but striving for a score of zero is inviting pretty close scrutiny... Husk has 256 characters on its codepage, so this pangram needs to use all of them. Aiming for a zero score also means that (a) the 'program' code cannot easily include any of the letters of 'Hello, World!', and (b) we need to find a way to 'recycle' the letters 'l' and 'o', which each occur more-than-once in the output. Unfortunately, Husk uses '!' as its indexing function, which rules-out the most straightforward approach to extracting elements from a long string, so we need to find a different way to do this. Here's my approach: line 2: the encoding string (228 characters, + 2 characters ¢") ¢"H½↕↑↓↔∟¦¡¿ ... öüÿø◊□¶«» # A 228-character string, repeated forever. # Since one of the characters is a '\', though, # this is read by Husk as a 227-character array. # The characters of 'Hello, World!' are inserted # at specific positions in the infinite string, # (so they occur out-of-order in the single copy).  line 1: the indexing program (26 characters)  †ȯ c¨abqnpsyhkzjwf # For all the codepoints of the index string "abqnpsyhkzjwf": *2 # double them → # and add 1. C₁ # Now divide the encoding string into substrings with these lengths m← # and get the first letter of each.  The indexing string "abqnpsyhkzjwf" is constructed to 'hit' the letters 'o' and 'l' 2 and 3 times, respectively, by 'wrapping around' in the infinite list, so that those letters only need to occur once in the encoding string. The largest index needs to be the same as the length of the encoding string, in order to 'hit' the same target ('l') twice in a row: this is achieved with 'q' (2x codepoint 113 + 1 = 227). • @Razetime - Yeah, but this isn’t code golf, so I need to use all 256 characters, right...? Mar 1 at 6:56 • hmm yeah (silly me) Mar 1 at 7:07 # Ruby, 119 112 bytes / score 17 puts ["%x"%(("!\#&+,-01245:;<>?@ABDEFIJKLNOQRUVWXYZdflqnry{|}"=~/$/)^"s8j9bePwGp7SgMTCvznH".to_i(36))].pack'h*'


Try it online!

# C (gcc), 111 109 bytes, score = 14

main(){printf("H%cllo, Wo\x72ld!",39+sizeof"14568:<=>?@ABCDEFGIJKLMNOPQRSTUVXYZ[]bghjkquvwy0|~#$&'*-./^_");}  Try it online! Edit: bugfix thanks to Noodle9 Edit 2: changed order of numbers and operators in the string to fix a problem found by G B, replaced "Hello, World!" with "Hello, Wo\x72ld!" ## shorter solution based on Sheik Yerboutis Code (107 bytes, score = 12) main(){printf("H%cllo, Wo\x72ld!","_:?=<#$&*-+^|./4138596@ABCDEFGIJKLMNOPQRSTUVXYZbghjkquvwysz0~e"['>']);}


Try it online!

• @Noodle9 thanks, it should be fixed now
– xibu
Feb 25 at 15:41
• -5 characters Feb 25 at 16:08
• @Sheik Yerbouti I dont' think, that that solution is allowed. You can remove letters from the string and numbers from the index at the same time. example
– xibu
Feb 25 at 16:20
• @xibu oh you are right! I fixed it at the cost of one character Try it online! Anyway, your sizeof approach is different enough from this shorter code to be posted alongside with it. Feb 25 at 16:29
• Still not ok: main(){printf("H%cllo, World!",79|35);}
– G B
Feb 25 at 21:39

print('o#$%&*./0W368;<=>? @ABCDEFG,IJKLMNOPoQRSTUVXY\154Z^_abcflghjkmqsuevwyz{|}~H'[::-9]+"\x72ld!")  Try it online! # Backhand, 100 - 95 = 5 M#$%&"()*+H-./0e1234l5678l9:;<o=>?@,ABCD FGIJWKLNOoPQRSrTUVXlYZ[\c^_b"dfgh]ikmn'pqst!uvwxryz{}a|~jE


Try it online!

Note that the version on TIO is missing a couple of instructions (notably '), so I've copied the interpreter here. This program works because Backhand executes every fifth instruction thanks to the first M (it's actually a little more complex than this), so the actual code is more like:

M    "    H    e    l    l    o    ,         W    o    r    l    c    "    ]    '    !    r    a   j


However, since you can't remove the spaces inbetween without breaking the flow of the program, you can replace them with whatever you want. The final check is that the j jumps to the 10th character (H) to halt and output,, which is less feasible if you modify the program. It's possible you might be able to form a valid program from this mishmash, but it is unlikely, and I'm sure that there's another permutation that fixes that.

### Explanation:

M                      Increase the step count from 3 to 5
"Hello, Worlc"        Push the string to the stack
]       Increment c to d
'!     Push !
r    Reverse the stack
aj  Jump back to the 10th character
H                    Halt and output the stack

• you can remove the ~ then it goes 2 back and 1 forth, and return still return to 10th position Feb 26 at 15:35
• @Alexbries ah right, should have been more careful with placing that }s. Fixed
– Jo King
Feb 27 at 3:18

alert(Hell+String.fromCharCode(057^"#$%&*-/1234689:;<=>?@ABDEFGIJKLMNOPQRTUVXYZ][_bcjkpqsuvwxyz{|}~\\".length)+', World!') The os of fromCharCode cannot be put inside quotes. Its char code is 111, which can't be uses directly as an argument to String.fromCharCode. You can't XOR to get it because you need 64, 86, 104 or 106, which are also impossible, I think. • Aren't there 95 printable ASCIIs? Feb 25 at 10:04 • @DominicvanEssen Sorry, I have a headache, I just copied some number I saw without thinking too hard about it... – Neil Feb 25 at 10:06 • @Alexbries Your version still outputs Hello, World! if you remove the leading !. – Neil Feb 25 at 11:13 • I just noticed that it can be reduced to these 2 variants, but you can fix it by simply moving the 5 before the 1 Feb 25 at 20:54 • @Alexbries I just managed to golf a byte off using ^, I think it's safe from your variants this time... – Neil Feb 26 at 0:56 # JavaScript (Node.js), 118117 116 - 95 = 21 shoutout to tsh for spotting 2 issues alert(Hello, Wo${('\71'+";#%&*/8025:<=>[]?@ABCDEFGIJKLMNOPQRTUVXYZ|_bcfjkpmqsuvwxyz".length^-~94).toString(36)}d!)


Try it online!

• Maybe remove the \
– tsh
Feb 26 at 3:25
• @tsh but then i don't have all the ascii pritable characters Feb 26 at 8:17
• I mean this program may still print "Hello, World!" without the \ in it. So it does not follow the rule of "may not have unnecessary characters"
– tsh
Feb 26 at 9:04
• ${...length...} -> l – tsh Feb 26 at 12:28 # BASIC, 129 bytes FOR i=8-2 TO 79 STEP 3+3:PRINT MID$("9*./!H065<>e?@ABClGJKLQlUVYZ[o\]^_,abcf  ghjksWmnpqxotuvwyrz4{|}l~#%&'d",MOD(i,73),1);:NEXT


Try it online!

Updated to a valid version thanks to Dominic van Essen.

• Welcome to Code Golf! Nice first answer. Feb 27 at 18:45
• I'm afraid I've deleted 5 characters (+3#%&) and it still works... try it... Feb 27 at 23:46
• Something like this might be golfable, though...? Feb 28 at 0:24
• @Dominic van Essen - Ahhhhh.... guess I'm not as smart as I thought I was. Haha delete one character it stops working, delete almost the whole thing and it works fine. Hmmm. I'll look at your example. Feb 28 at 2:52
• Unfortunately ,don't worry we got face slaped like this too Mar 3 at 11:01

# R, 119 117 bytes, score=24 22

Thanks to Dominic van Essen for spotting a bug.

cat('Hello, Wo',intToUtf8(nchar("#$%&*-./012479:;<>?@ABDEFGIJKLMNOPQRSVXYZ[]^_bgjkmquvwyz{|}~")+53),"\x6Cd!",sep="")  Try it online! Uses the hex code trick to encode the last l as \x6C. This saves 2 bytes: 1 by avoiding the reuse of the l (none of the other characters are used anywhere else), and 1 by avoiding having to escape the \ (as \\) in the string. The long string in the middle is 61 characters long. They are all necessary to get the character r (ASCII code 114), which is produced by the intToUtf8(nchar("...")+53) part. • I deleted some characters: try it... Feb 25 at 10:29 • @DominicvanEssen argh, how did I miss that? Fixed now (I hope). Feb 25 at 10:30 # C (gcc), score 114 - 95 = 19 Saved 2 bytes and removed 3 points thanks to Sheik Yerbouti!!! j;main(){for(;j<74;j+=6)putchar("H#$%&'e*-./0l12358l9:>?@oABCDE,FGIJK LMNOPWQRSTUoVXYZ\\r^_bglkqsvwdxyz|~!"[j]);}


Try it online!

All characters outside of the double-quotes are needed in order for the program to compile and run properly. Taking any of the characters out from the double-quoted string will mess-up Hello, World! from being printed properly. That string is exactly Hello, World! with 5 characters in between each character.

• -3 bytes Feb 25 at 15:48
• @SheikYerbouti Nice one - thanks! :D Feb 25 at 15:56