text:
# “Hello, World!”

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with , and counting). While this is not the most interesting code golf in the common languages, finding the shortest solution in certain esolangs can be a serious challenge. For instance, to my knowledge it is not known whether the shortest possible Brainfuck solution has been found yet.

Furthermore, while all of Wikipedia (the Wikipedia entry has been deleted but there is a copy at archive.org ), esolangs and Rosetta Code have lists of "Hello, World!" programs, none of these are interested in having the shortest for each language (there is also this GitHub repository). If we want to be a significant site in the code golf community, I think we should try and create the ultimate catalogue of shortest "Hello, World!" programs (similar to how our basic quine challenge contains some of the shortest known quines in various languages). So let's do this!

## The Rules

• Each submission must be a full program.
• The program must take no input, and print Hello, World! to STDOUT (this exact byte stream, including capitalization and punctuation) plus an optional trailing newline, and nothing else.
• The program must not write anything to STDERR.
• If anyone wants to abuse this by creating a language where the empty program prints Hello, World!, then congrats, they just paved the way for a very boring answer.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

• Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.
• This is not about finding the language with the shortest "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".
• If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf - these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

For inspiration, check the Hello World Collection.

## The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:

## [><>](https://esolangs.org/wiki/Fish), 121 bytes

/* Configuration */

var QUESTION_ID = 55422; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

}

jQuery.ajax({
method: "get",
dataType: "jsonp",
crossDomain: true,
success: function (data) {
data.items.forEach(function(a) {
});
comment_page = 1;
}
});
}

jQuery.ajax({
method: "get",
dataType: "jsonp",
crossDomain: true,
success: function (data) {
data.items.forEach(function(c) {
if (c.owner.user_id === OVERRIDE_USER)
});
else process();
}
});
}

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

function getAuthorName(a) {
return a.owner.display_name;
}

function process() {
var valid = [];

var body = a.body;
if(OVERRIDE_REG.test(c.body))
body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
});

var match = body.match(SCORE_REG);
if (match)
valid.push({
user: getAuthorName(a),
size: +match[2],
language: match[1],
});
else console.log(body);
});

valid.sort(function (a, b) {
var aB = a.size,
bB = b.size;
return aB - bB
});

var languages = {};
var place = 1;
var lastSize = null;
var lastPlace = 1;
valid.forEach(function (a) {
if (a.size != lastSize)
lastPlace = place;
lastSize = a.size;
++place;

.replace("{{NAME}}", a.user)
.replace("{{LANGUAGE}}", a.language)
.replace("{{SIZE}}", a.size)

var lang = a.language;
lang = jQuery(''+lang+'').text();

languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
});

var langs = [];
for (var lang in languages)
if (languages.hasOwnProperty(lang))
langs.push(languages[lang]);

langs.sort(function (a, b) {
if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
return 0;
});

for (var i = 0; i < langs.length; ++i)
{
var language = jQuery("#language-template").html();
var lang = langs[i];
language = language.replace("{{LANGUAGE}}", lang.lang)
.replace("{{NAME}}", lang.user)
.replace("{{SIZE}}", lang.size)
language = jQuery(language);
jQuery("#languages").append(language);
}

}
body {
text-align: left !important;
display: block !important;
}

width: 290px;
float: left;
}

#language-list {
width: 500px;
float: left;
}

font-weight: bold;
}

table td {
}

Shortest Solution by Language

Language	User	Score

	Author	Language	Size

• Must the language meet our usual requirements for what a programming language is, or are we operating by kolmogorov complexity rules? – isaacg Aug 28 '15 at 13:54
• @isaacg No it doesn't. I think there would be some interesting languages where it's not obvious whether primality testing is possible. – Martin Ender Aug 28 '15 at 13:56
• If the same program, such as "Hello, World!", is the shortest in many different and unrelated languages, should it be posted separately? – aditsu Aug 28 '15 at 15:33
• @mbomb007 Well it's hidden by default because the three code blocks take up a lot of space. I could minify them so that they are a single line each, but I'd rather keep the code maintainable in case bugs come up. – Martin Ender Aug 28 '15 at 19:34
• @ETHproductions "Unlike our usual rules, feel free to use a language (or language version) even if it's newer than this challenge." Publishing the language and an implementation before posting it would definitely be helpful though. – Martin Ender Aug 29 '15 at 23:01

# Sad-Flak, 199+3 bytes = 202 bytes

3 bytes for the -A arg. This lang uses a "codepage", where ≤≥ are one byte each (that is, I have a thing that replaces  and ~ with those chars and runs it)

32
({}≤()≥)
(≤()≥)
99
({}≤()≥)
((<>[≤()≥]))
7
({}≤()≥)
((<>))≤()≥
5
({}≤()≥)
(≤()≥)
109
({}≤()≥)
(<>)(≤()≥)
85
({}≤()≥)
(≤()≥)
30
({}≤()≥)
(≤()≥)
42
({}≤()≥)
({≤()≥})(({()}))({()})(())
70
({}≤()≥)
≤≥

Try it online!

## Explanation:

The main idea behind this is that the way Sad-Flak works, you can easily get it to repeat a line a constant number of times.

in Sad-Flak, there is a line pointer. The line pointer starts at the beginning

-> 32
({}≤()≥)
(≤()≥)
99
({}≤()≥)
((<>[≤()≥]))
7
({}≤()≥)
((<>))≤()≥
5
({}≤()≥)
(≤()≥)
109
({}≤()≥)
(<>)(≤()≥)
85
({}≤()≥)
(≤()≥)
30
({}≤()≥)
(≤()≥)
42
({}≤()≥)
({≤()≥})(({()}))({()})(())
70
({}≤()≥)
≤≥

however, the 32 is not actually a command. it is a simple way to express 32 blank lines. I could expand them for the demonstration, but then it would be unreadable. anyway.

So, the line pointer points at the first of 32 blank lines. When the line pointer points at a non-blank line, it will execute that line. when the line pointer points at a blank line, it will execute the first non-blank line after that line. that means we execute ({}≤()≥). What does this line do? This lang is a brainflak derivative, btw, so some of the brackets do the same thing, but not all

(        push...
{}      pop off the main stack and evaluate to that value, plus
≤     jump by the amount inside, evaluate to that value for the purpose of other commands
()   1
≥
)

so, this pops off the stack, adds one to it while jumping one forward, then pushes back on the stack. What is jumping? why are we jumping in the middle of a line?

Jumping in Sad-Flak is rather different to most other langs. Jumping does not take immediate effect, but rather moves the line pointer. when the line pointer is moved, nothing happens until the current line is finished executing. when it is finished, we see which line the line pointer points at, and execute that. If the line pointer didn't get moved, the same line gets executed again, and again, until it gets moved. however, all lines in this program either are blank, or they jump or halt. So, this line moves the line pointer one forward and increments top of stack.

What is the line pointer pointing at now? it's still on a blank line, so it does the same thing again, and again, until it gets to the line that it keeps executing

   32
-> ({}≤()≥)
(≤()≥)
99
({}≤()≥)
((<>[≤()≥]))
7
({}≤()≥)
((<>))≤()≥
5
({}≤()≥)
(≤()≥)
109
({}≤()≥)
(<>)(≤()≥)
85
({}≤()≥)
(≤()≥)
30
({}≤()≥)
(≤()≥)
42
({}≤()≥)
({≤()≥})(({()}))({()})(())
70
({}≤()≥)
≤≥

Then, it executes it one last time, before moving to the next line. this end up with the charcode of ! on the stack (32 blanks + 1 actual line)

   32
({}≤()≥)
-> (≤()≥)
99
({}≤()≥)
((<>[≤()≥]))
7
({}≤()≥)
((<>))≤()≥
5
({}≤()≥)
(≤()≥)
109
({}≤()≥)
(<>)(≤()≥)
85
({}≤()≥)
(≤()≥)
30
({}≤()≥)
(≤()≥)
42
({}≤()≥)
({≤()≥})(({()}))({()})(())
70
({}≤()≥)
≤≥

this line ((≤()≥)) pushes a new 1 to the stack, and moves the line pointer one forward, onto a new blank line, to do basically the same thing as it did before. however it puts charcode of e. and also the next line is this: ((<>[≤()≥])). What is this complex line? well:

((        push twice...
<>      value popped from stack, and pushed onto the offstack for later retrieval
[     minus ...
≤    (jump but eval to the argument still)
()  1
≥
]
))

so, this pops the e off the stack, and replaces it with two ds, while leaving an e on the off stack for later retrieval, and also jumping the line pointer to the next line. we have two, because one will be changed into l, because it saves bytes from pushing a 1 and incrementing it up to the next letter. we don't do this for all of them because it also cost bytes popping and pushing back onto the stack, as well as fitting the jump in there.

from now on, I'm skipping the blank lines and the increment top of stack lines, because this explanation is long enough already.

after adding 8 to yield l

((          push twice...
<>        a value popped from stack, also pushed to offstack
))
≤     jump ...
()   1
≥

add 6 to yield r: this one again: (≤()≥) new value at 111 (o):

(           push...
<>         popped value, also pushed to offstack.
)
(       push...
≤      (jump and eval to same as...)
()    1
≥
)

so this pushes to the off stack while keeping it on the stack, and pushing another 1 on the stack.

new 87 (W): this again: (≤()≥)

new 32 (space): same again: (≤()≥)

new 44 (,): ({≤()≥})(({()}))({()})(()) woah, what is that? put simply, it is just pushing onto the main stack what we pushed on to the offstack, then a 1 to make into a H:

(             push...
{            pop from the off stack, evaluate to that multiplied by...
≤           jump and eval to...
()         1
≥
}
)         this pushes o

((         push twice...
{        multiply an offstack popped value by...
()      1
}
))     this pushes l twice

(        push...
{       offstack popped value times...
()     1
}
)      this pushes e

(    push...
()  1
)

new 72 (H): ≤≥: this is the halt command and it stops the program

That pushed !dlroW ,olleH char codes, which then gets printed, but backwards because it is a stack. "Hello, World!"

# Cubically, 12412311199 78 bytes

-11 bytes thanks to TehPers, -12 thanks to language updates, -21 thanks to user202729

RU+432@6+50-4@6+3-4@6@6+1-00@6-331@6-00@6+4110@6+0000@6+1-00@6-0@6-2+4@6-331@6

Generated via this amazing algorithm.

There is a good explanation of Cubically in this question.

Cubically, the Rubik's Cube Programming Language, is the most complex language I have ever written, or dealt with, for that matter. It entirely comprises of operations on a single 3x3 Rubik's Cube in its memory, and one extra value, the "notepad".

The only way to perform mathematical operations is to take values from a certain cube face and add/subtract/multiply/divide it with the scratch pad value, replacing said value.

For example, performing /0 divides the notepad value by the sum of all integers on the 0-indexed face, or the first face.

The cube starts out initialized like this:

   000
000
000
111222333444
111222333444
111222333444
555
555
555

Performing a 90-degree clockwise turn on the right face will make the cube look like this:

   002
002
002
111225333044
111225333044
111225333044
554
554
554

Version from TehPers:

Here's a run-down of how the program works: (Note that I have replaced @6 with @ in the code, but changing each instance in the rest of this answer would be too tedious and I need to get back to real life.)

• +53 adds the DOWN face and RIGHT faces into the notepad, in this case, 45 and then 27. This results in 72, the ASCII code for H.
• @6 prints the notepad value as ASCII.
• :2 sets the notepad to the value of the FRONT face (18).
• /1 divides the notepad by the LEFT face (9), resulting in 2.
• +551 Adds the DOWN face (45) twice, then the LEFT face (9). As you can see, without rotating the cube, the faces will contain a total value equal to 9 times the index. For example, face index 5 has a value of 45, face index 1 has a value of 9, and so forth. After rotating the cube, this no longer applies.
• @6 again prints the notepad value, or e.
• :5 sets the notepad to the value of the DOWN face (45).
• +52 adds the DOWN face (45) and the FRONT face (18) to the notepad.
• @66 prints the current notepad value as a character twice. At this point Hell has been printed, which should be good enough for this language. :P
• :3/1 sets the notepad to the value of the RIGHT face (27), then divides the notepad by the value of the LEFT face (9), resulting in 3. Do you see the pattern yet?
• +552 adds 108 to the notepad, or 9*(5+5+2). Remember, if you rotate the cube, then the faces will not necessarily be multiples of 9!
• @6 prints the notepad value as a character, finishing the word "Hello".
• From this point there is nothing interesting. The program follows the pattern of setting the notepad value to whatever c % 9 is (where c is the target character), then adding multiples of 9 to the notepad get to the target character. The faces are not rotated, so this isn't exactly the best showcase program for Cubically, but it's certainly simpler than what could be accomplished with rotating the faces. There may be a shorter way to write this program using rotations, though.

Original (written by hand >.<)

+53@6+1F2L2+0@6L2F2U3R3F1L1+2@66L3F3R1U1B3+0@6:4U1R1+00@6-000@6+50000@6+000000@6+2-000000@6-5+4000@6-00@6/0+00@6:0+0/0+00@6

The above Hello World program uses arbitrary turns that I fiddled with until they got some desired values. Eventually, I got the top face to add up to 4 and made do with that.

Here's a run-down of how the program works:

• +5+3 adds the DOWN face and RIGHT faces into the notepad, in this case, 45 and then 27. This results in 72, the ASCII code for H.
• @6 prints the notepad value as ASCII.
• +1 adds the LEFT face to the notepad value, resulting in 81.
• F2 turns the FRONT face to look like this.
• L2 turns the LEFT face to look like this.
• +0 adds the UP face to the notepad, resulting in 101.
• @6 prints memory as ASCII e.
• L2F2U3R3F1L1 turns the cube to look like this.
• +2 adds the FRONT face to the notepad, resulting in 108. @66 prints as ASCII twice ll. At this point Hell has been printed, which should be good enough for this language. :P
• L3F3R1U1B3 turns the cube to look like this.
• +0 adds the UP face to the notepad (resulting in 111), @6 prints it as ASCII o.
• :4 sets the notepad to the BACK face 36.
• U1R1 turns the cube to look like this. The cube is not turned again 'cause this was about as good of a setup I could get.
• +0+0 adds the UP face to the notepad twice, resulting in 44.
• @6 prints as ASCII ,.
• -000 subtracts 12 from the notepad (32). @6 prints as ASCII .
• From this point there is nothing interesting except messing with the existing faces, particularly the top face (which has a convenient value 4), to print the remaining characters.
• It's not complex, just insanely difficult :o – HyperNeutrino Jun 15 '17 at 0:45
• @HyperNeutrino It's rather complex. Wait for the explanation :P – MD XF Jun 15 '17 at 0:46
• you should change the title on this – Destructible Lemon Jun 15 '17 at 1:32
• Also that is not postfix – Destructible Lemon Jun 15 '17 at 1:32
• @DestructibleLemon oh duh – MD XF Jun 15 '17 at 1:38

# Pain-Flak, 152 bytes

)))))}{}{)))}{))(}{((((])][][][([(])()()([((]][[()()()(])}{][][)][(][([())(]][][][][][[))(]][[)][][)][][][][))(}{}{))))(}{)}{)}{))()()()((((((((((((}><{

This is a trivial modification of @HeebyJeebyMan's “Hello, World!” in Brain-Flak. They also discovered a slightly different solution with the same length shortly before I golfed mine down to this byte count.

Try it online!

### How it works

Pain-Flak is transpiled to Brain-Flak as follows.

• Let the Pain-Flak source code be S.
• Transliterate S, replacing all opening brackets with their closing counterparts and viceversa. Call the result T.
• Reverse S character by character. Call the result R.
• The Brain-Flak source code is T || R, where || symbolizes concatenation.

For the Pain-Flak program in this answer, transpilation yields the following Brain-Flak program.

((((({}{}((({}((){}))))[([][][])])[()()()]))[[]])()()()[({}[][]([])[])])(()[[][][][][]](()[[]]([][]([][][][]((){}{}((((){}({}({}(()()()())))))))))))
{<>}
{<>}
(((((((((((()()()()){}){}){}()))){}{}())[][][][])[][])[[]]())[[][][][][]]())([([]([])[][]{})]()()()([[]](([()()()]([([][][])](((({}()){}))){}{})))))

Newlines have been inserted for "readability". The programs works as follows.

• Line 1 pushes garbage on the first stack.

• {<>} on line 2 switches stacks until the top of the stack is non-zero.

This switches to the second stack.

• {<>} does the same. Since the top of the second stack is 0, we stay on the second stack.

• Line 4 is just @HeebyJeebyMan's “Hello, World!” in Brain-Flak, which never switches stacks and is, therefore, unaffected by the garbage on the first stack.

• You care if i use the pain-flak description for my readme? – Christopher Jan 21 '18 at 0:17
• @Christopher2EZ4RTZ Go ahead. :) – Dennis Jan 21 '18 at 0:19

# Brain-Flak, 144 138 bytes

((((((((((((()()){}){}){}){}()))){}{}())([][]){})[][])[[]]())[((()[]){}){}])([()[]](([]([](([][]([](()[][]){})))[]{}[])[[]])))(([][][]){})

Try it online!

The product of my code from the Text to Brain-Flak challenge. Beats the previous answer by 4 bytes! Wheat Wizard has since updated to beat mine by 2. And my code has produced a 140 byte solution (which I've golfed a further 2 bytes off).

Explanation coming as soon as I understand it myself...

### How It Works:

Note that Brain-Flak is a stack based language which outputs the stack on exit. This means the text has to pushed to the stack in reverse.

((((((((((((()()){}){}){}){}()))){}{}())([][]){})[][])[[]]())[((()[]){}){}])

This first part pushes "World!". This part is actually near identical to Wheat Wizard's answer, and has the same byte count.

( Pushing "W"
( "o"
( "r"
( "l"
( "d"
( "!"
(((((
(()()) Push 2
{}) Pop the 2 to push 4
{}) Pop the 4 to push 8
{}) Pop the 8 to push 16
{}()) Pop the 16 and create a 1 to push 33 ("!")
)){}{}()) Create two copies of 33 and pop them to push 99 and a 1 to push 100 ("d")
([][]) Push the stack height (2) twice to the stack
{}) Pop the 4 and push 8 + 100 = 108, ("l")
[][] Add the stack height (3) twice to the current value
) Push 108 + 3*2 = 114 ("r")
[[]]() Add negative stack height (4) and 1 to the current value
) Push 114 + (-4) + 1 = 111 ("o")
[ Subtract
(
(()[]) Push stack height (5) + 1
{}) Pop the 6 to create 12
{} Pop the 12 to create 24
]) Push 111 - 24 = 87 ("W")

This part pushes "ello, "

([()[]](([]([](([][]([](()[][]){})))[]{}[])[[]])))

( "e"
[()[]] Save negative stack height (6) and 1 for later (-7)
( "l"
( "l"
[] Save stack height (6) for later
( "o"
[] Save stack height (6) again
(( ","
[][] Save stack height (6) twice (12)
( " "
[] Save stack height (6)
(()[][]){} Push 1 + stack height (6)*2 = 13 and double it = 26
) 26 + 6 = 32 (" ")
) 32 + 12 = 44 (",")
)[]{}[] Add the stack height (9), pop the 44 and add the stack height again (8)
) 44 + 9 + 44 + 8 + 6 (saved) = 111 ("o")
[[]] Subtract stack height (9)
)) Push 111 - 9 + 6 (saved) = 108 ("l") twice
) Push 107 - 7 = 100 ("e")

And finally (([][][]){}) pushes "H" by adding the stack height (12) three times and doubling it.

# Mind, 26 bytes

The program is encoded in Shift_JIS:

ﾒｲﾝは
"Hello, World!"

It means something like:

MAIN is:
"Hello, World!"
display

As you can see, Mind is a Japanese programming language. It's based on Forth, which turns out to suit Japanese's SOV word order rather well!

# Inform 7 + C by G, 36 bytes

Include C by G.Z:say "Hello, World!"

This code requires at least version 1/150829 of the code golfing extension.

• I got rid of my old version. – Lynn Aug 29 '15 at 5:20
• Please change the language name to "Inform 7 + C by G", since you're using a library – ASCII-only Apr 20 '18 at 1:22
• @ASCII-only As the cost of the library is included I don't think that's necessary. – curiousdannii Apr 20 '18 at 1:34
• @curiousdannii nope, it's still necessary (at least for libraries that don't come with the standard distribution) – ASCII-only Apr 20 '18 at 2:48

# Whirl, 955 733 bytes

-~200 bytes using implicit modulo when output magic - I haven't checked anywhere close to all the simple possibilities, so this might be very suboptimal.

It might be possible to use memory/the operations wheel value as extra storage to make things shorter, but all approaches I've tried using those are not golfier than the naive one

1100001110010001111100110000000000000100000100000100000110000010000100100010001000000000000111110001111000111110001111000000000000011110000011100100011001111110001110011111000000000000000000000000000100100110000001111110001110011111000000000001001000100010000000000001111100000111110001001000110001000111110000011110000000000000000010001001100111111000100111110011000000000000000000000000010000011000000000110010001100010000000000011111000001111000000000000000000111110001111000111110001111000001001001100111111000111001111100000000000100100111001111110001111001111100000000000000000000000111100000111001000111001111110001111001111100000000000000000000000000000001111000001110010010001000000000000000000000000111110000011111000100100

Try it online!

1 _
: ; _ + _ + _ + _ : _ + _ : _ * _ + _ : .
+ _ + _ + _ + : - _ + _ + _ + _ - _ : . _ :
+ _ + _ + _ + _ + _ + _ + _ : . _ . _ :
+ _ + _ + _ : .
+ _ + _ + _ + : + _ : .
* _ - _ + _ + _ + _ + _ : . _
: ; _ + _ + _ + _ + _ + _ + _ : _ * _ * _ : .
* _ * _ * _ - _ + _ + _ + _ + _ + : - _ + _ : . _ :
+ _ + _ + _ : . - :
+ _ + _ + _ + _ + _ + _ - _ : . - :
+ _ + _ + _ + _ + _ + _ + _ + _ - _ : .
+ _ + _ + _ + _ + _ + _ + : + _ : .

Every command switches operation wheels, starting from the operation wheel. Note that the cost depends on the current and previous command of the wheel, which is why there are so many no-ops.

Each character is on its own line, except for the two ls in a row. Some constructs used here are:

• : ; - load the 1 from operation value into math value
• _ + - add memory to math value - this can be used for e.g. repeated additions to emulate multiplications
• _ * - square. This is used for H since 72 = 8 * 8 + 8
• : . _ - store math value to memory, output, switch back to math wheel

Lines ending with : indicate the 1 from the operation wheel is being loaded, but the math value is not being overwritten. This is useful when consecutive characters are close in character codes.

### Operation wheel commands

• 1 - set (operation) value to 1
• : - store value into memory. In this program it's always 1
• . - output chr(memory)

### Math wheel commands

• + - add memory to (math) value - this is different to operation value
• * - multiply memory with value
• - - negate value - this is the only way to subtract
• ; - load memory into value
• : - store value into memory

See the language page for descriptions of unused commands

Try it online!

• :| this is shorter than the all-caps no-punctuation one here (official website). is everyone bad at golfing or do i just have no life? also i have absolutely no clue how to contact the author – ASCII-only May 6 '18 at 5:08

Logo (programming language) - 20 bytes

PRINT [Hello, World!]

Or even more exciting version:

to helloworld
hideturtle
fd 20 left 180
fd 40 left 180
fd 20 right 90
fd 20 left 90
fd 20 left 180
fd 40 left 90
fd 20 left 90
fd 20 right 90
fd 20 right 90
fd 10 right 90
fd 20 left 90
fd 10 left 90
fd 30 left 90
fd 40 left 180
fd 40 left 90
fd 20 left 90
fd 40 left 180
fd 40 left 90
fd 40 left 90
fd 20 left 90
fd 20 left 90
fd 20 left 90
fd 60 left 90
fd 40 left 180
fd 40 left 90
fd 20 left 90
fd 20 left 180
fd 20 left 90
fd 20 left 90
fd 40 left 180
fd 40 left 90
fd 40 left 90
fd 20 left 90
fd 20 left 90
fd 20 left 90
fd 40 left 90
fd 20 right 90
fd 20 right 90
fd 5  left 90
fd 5  left 90
fd 25 left 180
fd 40 left 90
fd 40 left 90
fd 20 left 90
fd 20 left 90
fd 20 left 90
fd 20 left 90
fd 40 left 180
fd 40
end

lt 90 pu fd 200 pd rt 90 helloworld

Output:

• Welcome to PPCG! This is code golf, so you should make sure that your answer is as short as possible. I don't know Logo, but it seems the HELLO is an arbitrary identifier, so you can probably shorten it and maybe it's also possible to get rid of some of that whitespace? Also, please use the required spelling Hello, World! and include the byte count of the code in your answer so that people can easily see its score. – Martin Ender Apr 10 '18 at 15:04
• First-timer here. Cool, thanks. – Artur Kędzior Apr 10 '18 at 15:09
• Hmm. I think you should stop drawing in between letters – ASCII-only May 18 '18 at 10:02

# unc, 38 bytes

ZNVa[]<<chgf[L'uRYYb~ JbeYQ#']:if 5:>>

# Scala, 22 bytes

print("Hello, World!")

scala can run "scala scripts" which are not full program. you can save the above to a file and execute in the shell scala file.scala, and it will execute (shortcut without saving a file: scala -e 'print("Hello, World!")').

a full ordinary scala program that prints hello world:

object H extends App{print("Hello, World!")}

# Nim, 20 19 bytes

echo"Hello, World!"

Saved one byte thanks to sp3000!

• You can drop the space in between for the first one, I think :) – Sp3000 Aug 28 '15 at 15:09
• Indeed, saved me one byte! – kvill Aug 28 '15 at 15:18

# Emily, 22 bytes

println"Hello, World!"

This is a nice little language I stumbled upon recently.

# Applescript, 15 bytes

"Hello, World!"

Normally a fairly verbose language, for this one this is all that is required.

• It's nice to see these verbose languages -- Applescript, PHP, PowerShell, etc. -- getting the better of lots of other languages for once. :) – AdmBorkBork Aug 28 '15 at 15:53
• @TimmyD That doesn't mean that they are good languages. It's just that they are better at some things. – georgeunix Aug 28 '15 at 16:53
• @georgeunix Oh, without a doubt. Every language has its pluses and minuses. There are plenty of things I'd change about PowerShell, but there's nothing else I'd rather use to script and config Exchange. Even if it had commands and functionality to do so, I don't think I could use Pyth or CJam or whatnot on a day-to-day basis instead. I was just meaning "It's nice to see non-golfing languages toward the top of the lowest-byte-count list for a change." – AdmBorkBork Aug 28 '15 at 17:06
• I understand @TimmyD – georgeunix Aug 28 '15 at 17:07

# VBScript, 28 Bytes

WScript.Echo "Hello, World!"

This (should be) the shortest that prints to STDOUT (i.e., the command prompt window), when executed via command prompt wscript .\hello-world.vbs or cscript //nologo .\hello-world.vbs (the //nologo is necessary to prevent copyright info from being displayed). If you just double-click it, you'll get a pop-up message box instead, similar to the shorter example, below, at 22 bytes:

MsgBox "Hello, World!"

When executed, this second option will output a pop-up message box displaying the text inside the quotes. Since it's not technically STDOUT, and we do have a legitimate way to display STDOUT, we'll count the longer version instead.

# Ook!, 949 Bytes

Just translated one of the Brainfuck answers here.

Ook! Ook! Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook.
Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?
Ook. Ook. Ook. Ook? Ook! Ook! Ook! Ook! Ook! Ook!
Ook! Ook! Ook. Ook? Ook! Ook! Ook! Ook! Ook! Ook?
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook.
Ook! Ook! Ook? Ook! Ook! Ook! Ook? Ook. Ook. Ook.
Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook! Ook! Ook!
Ook! Ook! Ook! Ook! Ook! Ook. Ook. Ook? Ook. Ook.
Ook. Ook. Ook. Ook. Ook! Ook. Ook. Ook? Ook! Ook!
Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook.
Ook? Ook. Ook! Ook. Ook? Ook. Ook! Ook. Ook? Ook.
Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook.
Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!
Ook! Ook! Ook! Ook. Ook? Ook. Ook! Ook! Ook! Ook.
Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook.

• I always smile when I see this language. – AdmBorkBork Aug 28 '15 at 16:36
• This might be a case of "If your language of choice is a trivial variant of another (potentially more popular) language...". The shortest Ook! program will always be the translation of the shortest BF program (because each BF character is converted to the same length in Ook). So if Ook has a separate answer it needs to be updated every time someone finds a new shortest Brainfuck solution. (Ultimately, it's your call though if Ook should remain separate.) – Martin Ender Aug 28 '15 at 17:06
• I love reading the "Code" in a manner as if two people were talking to each other :) – MrPaulch Aug 29 '15 at 11:12
• @MrPaulch I agree. The fact that first O is capitalized makes it sound like a fast Oh, okay with vocalized differences for punctuation in my mind. – mbomb007 Sep 1 '15 at 15:04

# Octave, 19 bytes

disp"Hello, World!"

# Vim, 17 bytes

iHello, World!{ESC}ZZ

Where {ESC} is a raw escape byte \x1b.

This will switch to insert mode (i), write Hello, World!, leave it (ESC), and save+quit (ZZ). An environment like vimgolf or anarchy golf has to do the output part for you, as Vim is, of course, just a text editor.

• @LegionMammal978 the other seems to be Vimscript mislabelled as Vim. – primo Feb 26 '16 at 18:33
• I think generally the standard is that vim solutions don't have to save and quit, they can just display the text onscreen at the end. (That's what mine have all done). This would allow you to take 3 bytes off. – DJMcMayhem Jun 29 '16 at 17:33
• Way longer and wrong output, but more interesting: :h_4<CR>/"H<CR>ly2wZZp – BlackCap Oct 12 '17 at 19:22

# TI-BASIC, 22 bytes

"Hello, World!

Note that the lowercase letters are 2 bytes each.

• I don't think the initial : is really part of the program, so I think this has a score of 22. – Ypnypn Aug 28 '15 at 16:06
• @Ypnypn I'll take your word on it :) – TheNumberOne Aug 28 '15 at 18:45

# PARI/GP, 22 bytes

print("Hello, World!")

# 4, 117 bytes

3.6000160103602136033260433605446067260787008070200908000120902111120111011015065095105105115055035075115125105085044

### How it works

Generating characters with a code point below 100 is straightforward.

I've managed to create the others (derol) with three assignments and five additions/subtractions, which I believe is optimal.

3.            Begin the program.
6 00 01     Set cell[ 0] to 1.
6 01 03     Set cell[ 1] to 3.
6 02 13     Set cell[ 2] to 13.
6 03 32     Set cell[ 3] to 32 = ' '.
6 04 33     Set cell[ 4] to 33 = '!'.
6 05 44     Set cell[ 5] to 44 = ','.
6 06 72     Set cell[ 6] to 72 = 'H'.
6 07 87     Set cell[ 7] to 87 = 'W'.
0 08 07 02  Set cell[ 8] to cell[ 7] + cell[2] =  87 + 13 = 100 = 'd'.
0 09 08 00  Set cell[ 9] to cell[ 8] + cell[0] = 100 +  1 = 101 = 'e'.
0 12 09 02  Set cell[12] to cell[ 9] + cell[2] = 101 + 13 = 114 = 'r'.
1 11 12 01  Set cell[11] to cell[12] - cell[1] = 114 -  3 = 111 = 'o'.
1 10 11 01  Set cell[10] to cell[11] + cell[1] = 111 -  3 = 108 = 'l'.
5 06        Print cell[ 6] = 'H'.
5 09        Print cell[ 9] = 'e'.
5 10        Print cell[10] = 'l'.
5 10        Print cell[10] = 'l'.
5 11        Print cell[11] = 'o'.
5 05        Print cell[ 5] = ','.
5 03        Print cell[ 3] = ' '.
5 07        Print cell[ 7] = 'W'.
5 11        Print cell[11] = 'o'.
5 12        Print cell[12] = 'r'.
5 10        Print cell[10] = 'l'.
5 08        Print cell[ 8] = 'd'.
5 04        Print cell[ 4] = '!'.
4             End the program.

# Var'aQ, 20 bytes

"Hello, World!" cha'

Var'aQ nIv rur Hol. 'oH rut lo' jIH ngaj-ghItlh.

Note: ghu'vam laH mugh jIH vaj DaneH'a'.

• mughwI' vItu' 'oHbe' majQa'. – mbomb007 Sep 1 '15 at 14:48
• @mbomb007 Qo', jIHvaD pIch, bing pIch – Beta Decay Sep 1 '15 at 14:51
• What language is this? – LegionMammal978 Sep 28 '15 at 1:00
• @LegionMammal978 Klingon :) – Beta Decay Sep 28 '15 at 5:52

# Q, 16 bytes

1"Hello, World!"

Just Y to go and we have the alphabet :)

Bit of a late update, but thanks to Mauris, we now have at least one language for every letter of the alphabet :D

Thanks @AaronDavies

• Not quite the requested output. I think you want 1"Hello, World!"; (doesn't include the trailing newline; to add one, change the 1 to a -1). Note, also valid for k. – Aaron Davies Aug 29 '15 at 23:19

# 123, 282 267 bytes

22221121121112112222222211211112111211211222222221121121133121121312121122222222111211213
31211213122222222111211332113312112222221112112331123322222221111211111211222221111211211
22222222112111112112112112222222111112112112112222213312112131222222221121113321133121121

The newlines are only for cosmetic purposes. I'm fairly sure that this is not optimal.

Here is a slightly more readable (and also runnable) version:

H 22221121121112112
e 2222222112111121112112112
l 22222221121121133121121312
l 12112
o 22222221112112133121121312
, 2222222111211332113312112
2222211121123311233
W 222222211112111112112
o 222211112112112
r 2222222112111112112112112
l 222222111112112112112
d 2222133121121312
! 2222222112111332113312112
1

I started out by constructing an optimal linear code (i.e. one which doesn't use 3s which allow for loop). That is quite simple: for each character, determine which bytes to flip from the last one. Move to the right-most character that has to be flipped (with a series of 2s), then move back to the left with 1 for each byte that has to be flipped and 121 for each byte that shouldn't be flipped. Finally move to the writing index -2 and print the character with 21. Repeat. At the very end, move to index -1 with a trailing 1 in order for the program to terminate.

This jumble of 1s and 2s was generated with this CJam script, which you can run online here:

0c"Hello, World!"+2ew::^{
_{2b8Ue[1a/W<1a*_,'2*'1@W%{'1"121"?}/"12"}{;"12112"}?
}/
'1

Then I removed some repetition of ones and twos by inserting loops by hand. 3 works as follows: if the instruction pointer is to the left of index 0, skip the 3. Otherwise, jump to the previous 3 if the current bit is 1 or jump ahead to the next 3 if the bit is 0. So simple loops, repeating a code segment x can be constructed as 33x33 or 33x3 (depending on whether the termination condition is "current bit is zero" or "moved to a negative index"). Then I started enumerating some relevant simple loops and when they are applicable. I've been using these loops only when moving back through the bits to change one character code to the next. If we can use a loop here depends both on the current state of a bit a and the target state b. I'll be denoting this combined state of each position as [a b]. Now here are the relevant loops and the required position patterns in a regex-like syntax:

121:    (^|[0 0]|[0 1]) ([1 1])+ [0 0]
112:    (^|[1 1]) ([0 0])+ ([0 1]|[1 1])
211:    ([0 0]|[0 1]) ([1 1])+ [0 0] ([0 0]|[1 1])
121121: ([0 0]|[0 1]) ([1 1] ([1 1]|[0 0]))+ [0 0]

Listing out the combined states for each character, we can annotate the potential loops and how many bytes they'll save (each ___ annotates the character above; sometimes multiple loops are possible):

H [[0 0] [0 1] [0 0] [0 0] [0 1] [0 0] [0 0] [0 0]]
e [[0 0] [1 1] [0 1] [0 0] [1 0] [0 1] [0 0] [0 1]]
l [[0 0] [1 1] [1 1] [0 0] [0 1] [1 1] [0 0] [1 0]]
__________________121 -2
________________________121121 -3
l [[0 0] [1 1] [1 1] [0 0] [1 1] [1 1] [0 0] [0 0]]
o [[0 0] [1 1] [1 1] [0 0] [1 1] [1 1] [0 1] [0 1]]
__________________121 -2
__________________211 -2
________________________121121 -3
, [[0 0] [1 0] [1 1] [0 0] [1 1] [1 1] [1 0] [1 0]]
________________________211 -2
[[0 0] [0 0] [1 1] [0 0] [1 0] [1 0] [0 0] [0 0]]
____________112 -2
W [[0 0] [0 1] [1 0] [0 1] [0 0] [0 1] [0 1] [0 1]]
o [[0 0] [1 1] [0 1] [1 0] [0 1] [1 1] [1 1] [1 1]]
r [[0 0] [1 1] [1 1] [0 1] [1 0] [1 0] [1 1] [1 0]]
l [[0 0] [1 1] [1 1] [1 0] [0 1] [0 1] [1 0] [0 0]]
d [[0 0] [1 1] [1 1] [0 0] [1 0] [1 1] [0 0] [0 0]]
__________________121 -2
________________________121121 -3
! [[0 0] [1 0] [1 1] [0 0] [0 0] [1 0] [0 0] [0 1]]
________________________211 -2

Now I just picked the most profitable loop in each case and inserted it into the code.

I'm fairly certain that one could find a couple more loops that I've overlooked. But I also think that it's possible to find a significantly shorter solution that isn't based on anything a human would come up with. So far I have no idea how to efficiently search for such a solution automatically though, so I'll leave it at that for now.

# Piet, 132 codels

On a 4x33 grid. On the last few commands I had to stretch to reach the end, meaning it could be golfed a little more (it probably fits on a 4x31 grid). Here it is, with codel size 10:

I made it in a rectangular space to minimize the number of time I needed to flip the pointer. The stack is based on numbers 36 and 108 that are constantly being duplicated or rolled to produce the new letters.

# Turing Machine Code, 132 bytes

As usual, I'm using the table syntax defined here.

0 * H r q
q * e r w
w * l r e
e * l r r
r * o r t
t * , r y
y * _ r u
u * W r i
i * o r o
o * r r p
p * l r a
a * d r s
s * ! r halt

If the above link isn't working (sometimes it works for me, other times the page refuses to load) you may also test this using this java implementation.

# Gol><>, 16 bytes

"!dlroW ,olleH"H

I've really enjoyed golfing in ><>, but unfortunately I've found that ><> lacks several features, e.g. STDIN integer input, which prevent it from being competitive in challenges it otherwise would be. Gol><> is designed to (hopefully) be an easier-to-use variation of ><>. I worked on it earlier in the year, around when the language showcase was happening, but took a break and only picked it up again recently. It's starting to stabilise, so I thought it'd be a good time to post a first answer.

Similarly to ><>, " is a string parsing operator which pushes chars one at a time until it reaches a closing ". H then halts the program, outputting the stack until it is empty.

Even without H, Gol><> can still output the stack in a relatively short way. l pushes the length of the stack, o outputs a char from the stack and R pops a number n, repeating the next instruction n times. Thus, an equivalent program would be

"!dlroW ,olleH"lRo;

where ; terminates the program with no output.

• Another solution would be S"Hello, World!". – LegionMammal978 Nov 9 '15 at 12:39
• @LegionMammal978 Indeed :) (although you'll need a ; at the end or it'll print forever) – Sp3000 Nov 9 '15 at 12:43

# Vitsy, 18 16 bytes

"!dlroW ,olleH"Z

"!dlroW ,olleH"     Push Hello, World! to the stack.
Z    Push the entire stack to STDOUT - equivalent to l\O

Output:

Hello, World!

Z is new syntax - it was not made for this question.

## Purple, 62 bytes

AA1AA1AA1bA1b1Bo1bb1bbibb1Bi1b
! d l r o W   , o l l e H

### Purple in a Nutshell:

Purple is a self-modifying language in the same sense that self-modifying brainfuck is: The code is executed from the same array that contains data, which is infinite and otherwise initialized with zeroes. It has one instruction with three arguments: subtract the third argument from the second and store it in the first. It has two registers, a and b, which can be dereferenced as A and B to get the contents of that memory address. It also has i, the instruction pointer, o which represents the outside world (i.e., stdout in the first argument, stdin in either of the other two), and the literal 1, which cannot be the first argument.

It is as hard to read and write as it looks.

### This Program:

It may seem strange that I'm entering a program that is almost more not-code than code in a contest for "shortest program", but it would be REALLY DIFFICULT to do it in less. The reason is that, when doing loops in Purple, it requires the least effort to jump to memory location 3 (because you just set i to 0), but this means you have exactly one instruction to initialize the loop. This means we need to set A to the location of the first character to be printed in a single instruction. Otherwise, we'd have to do a lot of extra work to jump somewhere else at the end of each loop. But since a starts out at zero, the only positive value we can set it to in a single instruction is 64. (i.e. the contents of the zeroth cell--the "A" itself, which is ASCII 65, minus one.)

Obviously, we're going to want to iterate backwards over the string since

• Iterating forwards means we have to put the string AFTER position 64, thereby making the program longer.
• It takes one fewer instruction to decrement the pointer than to increment it.

And we can shave bytes off the end of the program by decrementing the pointer before we print. In fact, we have enough space between the cell 64 and the end of the program to decrement twice between each address to be printed. Thus, the first character we need to print can be at character 62, hence, exactly 62 bytes long.

### Here's The Nitty:

AA1               Set the first cell to 64
AA1AA1            This is the entry point for the loop. M[0]=M[0]-2
bA1               Point b the cell to the left of what cell 0 points to.
b1B               Set b to one more than the opposite of the character there.
o1b               Output the character M[0] pointed to (one more than the opp. of b)
b1b               Set b to the just output character.
bib               Subtract the just output character from the IP (24)
Until we hit the newline (ascii 10), this yields a negative.
b1B               Set b to 1 minus what b was pointing to.
Negative addresses are initialized to zero, so until we hit the newline
this will set b to 1. When we hit the newline, b will be pointing to
the 11th character ("1"), and this will set it to -48.
i1b               Set the instruction pointer to 1-b.
Until the newline, this sets i=0, jumping back the beginning of the loop.
After the newline, this sets i=49, where it finds the
non-instruction "W  ", and Purple halts without error in such a case.

The rest of the program is the string itself and arbitrary padding to position the characters in the right place.

EDIT: Figured out how to save 30 bytes on this program, and updated all explanations to match the new version.

# TeaScript, 12 bytes

(using ISO/IEC 8859 character encoding)

DHÁM, Wld!

Compresses Hello, World!, decompresses with D (æ) function

• This is 12 bytes, I think; there should be an unprintable in Wl. – ETHproductions Jan 8 '16 at 2:58
• @ETHproductions you're right, whoops. I guess SE kills unprintables – Downgoat Jan 8 '16 at 2:58
• Perhaps a hexdump would be useful (via xxd or similar). – primo Jan 8 '16 at 4:25

# BTClang, 53 bytes

My newest invention! BTClang is short for Bitcoin language. Although it has nothing to do with bitcoins, it shares some similiarities with this language. Code:

4|\$&2h
2|A%
3|Im!
3|%([F
2|!4P
2|"Cv
3|zJO
1|!M
2|!&r

Explanation:

First of all, each line of the code consists of a number, a pipe and a key. The process goes as following for the example 2|5C. We take the key (5C), and generate the SHA256-hash of it. We get this:

ad5d3cc03d8b60e308b22e27fe4bbccae6a83d5496bc5e2a36aeb76eae51aeb0

The number before the pipe says how many hexadecimal number we want to extract from the end of the hash. This number is 2, so we take two 2-digit hexadecimal numbers from the end of the hash.

We are left with ae and b0. Converting these to integers will result into 174 and 176. These will be processed with the formula n % 94 + 32, so when this is converted to a character, the character will always be a printable ASCII character with 31 < ord < 128. The hashtags are replaced with newlines.

174 % 94 + 32 = 112 (p)
176 % 94 + 32 = 114 (r)

And so on...

The final translation of the code is print("Hello, World!"), which is then evaluated as normal Python. Although this is a solution, I am pretty sure this can be golfed further. It just takes a lot of computational power...

(By the way, you can try to find sets of characters yourself with the BTClang_miner)

• How do you choose which hexadecimal numbers? – Conor O'Brien Apr 8 '16 at 0:32
• @CᴏɴᴏʀO'Bʀɪᴇɴ You mean from the hash? The numbers chosen are all taken from the end of the hash. So from ad5d3cc03d8b60e308b22e27fe4bbccae6a83d5496bc5e2a36aeb76eae51aeb0, the last two hexadecimal numbers are ae and b0. – Adnan Apr 8 '16 at 14:15
• Oh, I'm an idiot. :| – Conor O'Brien Apr 8 '16 at 14:41


text:
In mathematics, a set is called finite if there is a bijection between the set and some set of the form {1, 2, . Mathematics is the body of Knowledge and Academic discipline that studies such concepts as Quantity, Structure, Space and In Mathematics, a bijection, or a bijective function is a function f from a set X to a set Y with the property . . , n} where n is a natural number. In Mathematics, a natural number (also called counting number) can mean either an element of the set (the positive Integers or an (The value n = 0 is allowed; that is, the empty set is finite. In Mathematics, and more specifically Set theory, the empty set is the unique set having no ( Zero) members ) An infinite set is a set which is not finite. In Set theory, an infinite set is a set that is not a Finite set.

Equivalently, a set is finite if its cardinality, i. In Mathematics, the cardinality of a set is a measure of the "number of elements of the set" e. , the number of its elements, is a natural number. More specifically, a set whose cardinality is n is also called an n-set. In Mathematics, an n-set is a set containing exactly n elements where n is a Natural number. For instance, the set of integers between −15 and 3 (excluding the end points) has 17 elements, so it is finite; in fact, it is a 17-set. The integers (from the Latin integer, literally "untouched" hence "whole" the word entire comes from the same origin but via French In contrast, the set of all prime numbers has cardinality 0, so it is infinite. In Mathematics, a prime number (or a prime) is a Natural number which has exactly two distinct natural number Divisors 1

A set is called Dedekind-finite if there exists no bijection between the set and any of its proper subsets. In Mathematics, a set A is Dedekind-infinite if some proper Subset B of A is Equinumerous to A. If the axiom of dependent choice (a weak form of the axiom of choice) holds, then a set is finite if and only if it is Dedekind-finite. In Mathematics, the axiom of dependent choices, denoted DC, is a weak form of the Axiom of choice (AC which is still sufficient to develop most of In Mathematics, the axiom of choice, or AC, is an Axiom of Set theory. Otherwise, paradoxically, there may be infinite Dedekind-finite sets (see Foundational issues below). In Mathematics, a set is called finite if there is a Bijection between the set and some set of the form {1 2.

All finite sets are countable, but not all countable sets are finite. (However, some authors use "countable" to mean "countably infinite", and thus do not consider finite sets to be countable. )

## Closure properties

For any elements x, y, the sets {}, {x}, and {x, y} are finite. The union of a finite set of finite sets is finite. The powerset of a finite set is finite. Any subset of a finite set is finite. The set of values of a function when applied to elements of a finite set is finite. The Cartesian product of a finite set of finite sets is finite. However, the set of natural numbers (whose existence is assured by the axiom of infinity) is not finite. In Axiomatic set theory and the branches of Logic, Mathematics, and Computer science that use it the axiom of infinity is one of the Axioms

## Necessary and sufficient conditions for finiteness

In Zermelo–Fraenkel set theory (ZF), the following conditions are all equivalent:

1. S is a finite set. Zermelo–Fraenkel set theory with the axiom of choice, commonly abbreviated ZFC, is the standard form of Axiomatic set theory and as such is the most common That is, S can be placed into a one-to-one correspondence with the set of those natural numbers less than some specific natural number.
2. (Kazimierz Kuratowski) S has all properties which can be proved by mathematical induction beginning with the empty set and adding one new element at a time. Kazimierz Kuratowski ( Warsaw, February 2, 1896 &ndash June 18, 1980) was a Polish Mathematician and Logician (See the section on foundational issues for the set-theoretical formulation of Kuratowski finiteness. )
3. (Paul Stäckel) S can be given a total ordering which is both well-ordered forwards and backwards. Paul Stäckel ( 20 August 1862 — 12 December 1919) was a German Mathematician, active in the areas of Differential In Mathematics, a well-order relation (or well-ordering) on a set S is a Total order on S with the property that every That is, every non-empty subset of S has both a least and a greatest element in the subset.
4. Every function from P(P(S)) one-to-one into itself is onto. That is, the powerset of the powerset of S is Dedekind-finite (see below). In Mathematics, given a set S, the power set (or powerset) of S, written \mathcal{P}(S P ( S)
5. Every function from P(P(S)) onto itself is one-to-one.
6. (Alfred Tarski) Every non-empty family of subsets of S has a minimal element with respect to inclusion. Alfred Tarski ( January 14, 1901, Warsaw, Russian ruled Poland – October 26, 1983, Berkeley California
7. S can be well-ordered and any two well-orderings on it are order isomorphic. In the mathematical field of Order theory an order isomorphism is a special kind of Monotone function that constitutes a suitable notion of Isomorphism In other words, the well-orderings on S have exactly one order type. In Mathematics, especially in Set theory, two Ordered sets XY are said to have the same order type just when they are Order isomorphic

If the axiom of choice also holds, then the following conditions are all equivalent:

1. S is a finite set. In Mathematics, the axiom of choice, or AC, is an Axiom of Set theory.
2. (Richard Dedekind) Every function from S one-to-one into itself is onto. Julius Wilhelm Richard Dedekind ( October 6, 1831 &ndash February 12, 1916) was a German mathematician who did important
3. Every function from S onto itself is one-to-one.
4. Every partial ordering of S contains a maximal element. In Mathematics, especially in Order theory, a maximal element of a subset S of some Partially ordered set is an element of S that

## Foundational issues

Georg Cantor initiated his theory of sets in order to provide a mathematical treatment of infinite sets. Georg Ferdinand Ludwig Philipp Cantor ( – January 6 1918) was a German Mathematician, born in Russia. Thus the distinction between the finite and the infinite lies at the core of set theory. Certain foundationalists, the strict finitists, reject the existence of infinite sets and thus advocate a mathematics based solely on finite sets. In the Philosophy of mathematics, finitism is an extreme form of constructivism, according to which a mathematical object does not exist unless it can be constructed Mainstream mathematicians consider strict finitism too confining, but acknowledge its relative consistency: the universe of hereditarily finite sets constitutes a model of Zermelo-Fraenkel set theory with the Axiom of Infinity replaced by its negation. In Mathematics, hereditarily finite sets are defined recursively as Finite sets containing only hereditarily finite sets (with the Empty set as Zermelo–Fraenkel set theory with the axiom of choice, commonly abbreviated ZFC, is the standard form of Axiomatic set theory and as such is the most common In Axiomatic set theory and the branches of Logic, Mathematics, and Computer science that use it the axiom of infinity is one of the Axioms

Even for those mathematicians who embrace infinite sets, in certain important contexts, the formal distinction between the finite and the infinite can remain a delicate matter. The difficulty stems from Gödel's incompleteness theorems. In Mathematical logic, Gödel's incompleteness theorems, proved by Kurt Gödel in 1931 are two Theorems stating inherent limitations of all but the most One can interpret the theory of hereditarily finite sets within Peano arithmetic (and certainly also vice-versa), so the incompleteness of the theory of Peano arithmetic implies that of the theory of hereditarily finite sets. In Mathematical logic, the Peano axioms, also known as the Dedekind-Peano axioms or the Peano postulates, are a set of Axioms for the Natural In particular, there exists a plethora of so-called non-standard models of both theories. See also Formal interpretation In Model theory, a discipline within Mathematical logic, a non-standard model is a A seeming paradox, non-standard models of the theory of hereditarily finite sets contain infinite sets --- but these infinite sets look finite from within the model. (This can happen when the model lacks the sets or functions necessary to witness the infinitude of these sets. ) On account of the incompleteness theorems, no first-order predicate, nor even any recursive scheme of first-order predicates, can characterize the standard part of all such models. So, at least from the point of view of first-order logic, one can only hope to characterize finiteness approximately.

More generally, informal notions like set, and particularly finite set, may receive interpretations across a range of formal systems varying in their axiomatics and logical apparatus. In formal logic, a formal system (also called a logical system, a logistic system, or simply a logic Formal systems in mathematics consist The best known axiomatic set theories include Zermelo-Fraenkel set theory (ZF), Zermelo-Fraenkel set theory with the Axiom of Choice (ZFC), Von Neumann–Bernays–Gödel set theory (NBG), Non-well-founded set theory, Bertrand Russell's Type theory and all the theories of their various models. Zermelo–Fraenkel set theory with the axiom of choice, commonly abbreviated ZFC, is the standard form of Axiomatic set theory and as such is the most common In the Foundations of mathematics, Von Neumann–Bernays–Gödel set theory ( NBG) is an Axiomatic set theory that is a Conservative extension Non-well founded set theories are variants of Axiomatic set theory which allow sets to contain themselves and otherwise violate the rule of Well-foundedness. Bertrand Arthur William Russell 3rd Earl Russell, OM, FRS (18 May 1872 – 2 February 1970 was a British Philosopher, Historian In Mathematics, Logic and Computer science, type theory is any of several Formal systems that can serve as alternatives to Naive set theory One may also choose among classical first-order logic, various higher-order logics and intuitionistic logic. Intuitionistic logic, or constructivist logic, is the Symbolic logic system originally developed by Arend Heyting to provide a formal basis for Brouwer

A formalist might see the meaning of set varying from system to system. A Platonist might view particular formal systems as approximating an underlying reality. Platonism is the Philosophy of Plato or the name of other philosophical systems considered closely derived from it

In contexts where the notion of natural number sits logically prior to any notion of set, one can define a set S as finite if S admits a bijection to some set of natural numbers of the form {x | x < n}. In Mathematics, a natural number (also called counting number) can mean either an element of the set (the positive Integers or an In Mathematics, a bijection, or a bijective function is a function f from a set X to a set Y with the property In Mathematics, a natural number (also called counting number) can mean either an element of the set (the positive Integers or an Mathematicians more typically choose to ground notions of number in set theory, for example they might model natural numbers by the order types of finite well-ordered sets. In Mathematics, a natural number (also called counting number) can mean either an element of the set (the positive Integers or an In Mathematics, a well-order relation (or well-ordering) on a set S is a Total order on S with the property that every Such an approach requires a structural definition of finiteness that does not depend on natural numbers. In Mathematics, a natural number (also called counting number) can mean either an element of the set (the positive Integers or an

Interestingly, various properties that single out the finite sets among all sets in the theory ZFC turn out logically inequivalent in weaker systems such as ZF or intuitionistic set theories. Two definitions feature prominently in the literature, one due to Richard Dedekind, the other to Kazimierz Kuratowski (Kuratowski's is the definition used above). Julius Wilhelm Richard Dedekind ( October 6, 1831 &ndash February 12, 1916) was a German mathematician who did important Kazimierz Kuratowski ( Warsaw, February 2, 1896 &ndash June 18, 1980) was a Polish Mathematician and Logician

Call a set S Dedekind infinite if there exists an injective, non-surjective function $f:S \rightarrow S$. In Mathematics, a set A is Dedekind-infinite if some proper Subset B of A is Equinumerous to A. Such a function exhibits a bijection between S and a proper subset of S, namely the image of f. Given an element x in a Dedekind infinite set S, we can form an infinite sequence of distinct elements of S, namely x,f(x),f(f(x)),. In Mathematics, a set A is Dedekind-infinite if some proper Subset B of A is Equinumerous to A. . . . Conversely, given a sequence in S consisting of elements x1,x2,x3,. . . , we can define a function f such that on elements in the sequence f(xi) = xi + 1 and f behaves like the identity function otherwise. Thus Dedekind infinite sets contain subsets that correspond bijectively with the natural numbers. In Mathematics, a set A is Dedekind-infinite if some proper Subset B of A is Equinumerous to A. Dedekind finite naturally means that every injective self-map is also surjective.

Kuratowski finiteness is defined as follows. Given any set S, the binary operation of union endows the powerset P(S) with the structure of a semi-lattice. In Mathematics, given a set S, the power set (or powerset) of S, written \mathcal{P}(S P ( S) A semilattice is a mathematical concept with two definitions one as a type of Ordered set, the other as an Algebraic structure. Writing K(S) for the sub-semi-lattice generated by the empty-set and the singletons, call set S Kuratowski finite if S itself belongs to K(S). Intuitively, K(S) consists of the finite subsets of S. Crucially, one does not need induction, recursion or a definition of natural numbers to define generated by since one may obtain K(S) simply by taking the intersection of all sub-semi-lattices containing the empty set and the singletons. In Mathematics, and more specifically Set theory, the empty set is the unique set having no ( Zero) members In Mathematics, a singleton is a set with exactly one element

Readers unfamiliar with semi-lattices and other notions of abstract algebra may prefer an entirely elementary formulation. Kuratowski finite means S lies in the set K(S), constructed as follows. Write M for the set of all subsets X of P(S) such that:

• X contains the empty set;
• X contains T implies X contains T union any singleton.

Let K(S) equal the intersection of M.

In ZF, Kuratowski finite implies Dedekind finite, but not vice-versa. In the parlance of a popular pedagogical formulation, when the axiom of choice fails badly, one may have an infinite family of socks with no way to choose one sock from more than finitely many of the pairs. That would make the set of such socks Dedekind finite, as any infinite sequence of socks would effectively produce an impossible selection. But Kuratowski finiteness would fail for the same set of socks.

format: plain


text:
Memory - Algorithmica

# Memory

If a CPU core has a frequency of 3 GHz, it roughly means that it is capable of executing up to $3 \cdot 10^9$ operations per second, depending on what constitutes an “operation”. This is the baseline: on modern architectures, it can be increased by techniques such as SIMD and instruction-level parallelism up to $10^{11}$ operations per second, if the computation allows it.

But for many algorithms, the CPU is not the bottleneck. Before trying to optimize performance above that baseline, we need to learn not to drop below it, and the number one reason for this is memory.

## A + B

To illustrate this point, consider this: how long does it take to add two numbers together? The only correct answer to this question is “it depends” — mainly on where the operands are stored.

Being one of the most frequently used instructions, add by itself only takes one cycle to execute. So if the data is already in registers, it takes one cycle. In general case (*c = *a + *b), it needs to fetch its operands from memory first:

mov eax, DWORD PTR [rsi]
mov DWORD PTR [rdx], eax

Typically, the data is stored in the main memory (RAM), and it will take around ~40ns, or about 100 cycles, to fetch it, and then another 100 cycles to write it back. If it was accessed recently, it is probably cached and will take less than that to fetch, depending on how long ago it was accessed — it could be ~20ns for the slowest layer of cache and under 1ns for the fastest. But it could also be that the data is stored on the hard drive, and in this case it will take around 5ms, or roughly $10^7$ cycles (!), to access it.

Because of such a high variance in performance, it is crucial to optimize IO operations before anything else.

## Memory Hierarchy

Modern computer memory is hierarchical. It consists of multiple cache layers of varying speed and size, where upper levels typically store most frequently accessed data from lower levels to reduce latency. Each new level is usually an order of magnitude faster, but also smaller and/or more expensive.

Abstractly, various memory devices can be described as modules that have a certain storage capacity $M$ and can read or write data in blocks of $B$ (not individual bytes!), taking a fixed time to complete.

From this perspective, each type of memory has a few important characteristics:

• total size $M$;
• block size $B$;
• latency, that is, how much time it takes to fetch one byte;
• bandwidth, which may be higher than just the block size times latency, meaning that IO operations can “overlap”;
• cost in the amortized sense, including the price for chip, its energy requirements, maintenance and so on.

Here is an approximate comparison table for commodity hardware in 2021:

Type $M$ $B$ Latency Bandwidth $/GB/mo1 L1 10K 64B 0.5ns 80G/s - L2 100K 64B 5ns 40G/s - L3 1M/core 64B 20ns 20G/s - RAM GBs 64B 100ns 10G/s 1.5 SSD TBs 4K 0.1ms 5G/s 0.17 HDD TBs - 10ms 1G/s 0.04 S3$\infty$- 150ms$\infty$0.022 Of course, in reality there are many specifics about each type of memory, which we will now go through. ### Volatile Memory Everything up to the RAM level is called volatile memory, because it does not persist data in case of a power shortage and other disasters. It is fast, which is why it is used to store temporary data while the computer is powered. From fastest to slowest: • CPU registers, which are the zero-time access data cells CPU uses to store all its intermediate values, can also be thought of as a memory type. There is only a very limited number of them (e. g. 16 “general purpose” ones), and in some cases you may want to use all of them for performance reasons. • CPU caches. Modern CPUs have multiple layers of cache (L1, L2, often L3, and rarely even L4). The lowest layer is shared between cores and is usually scaled with the their number (e. g. a 10-core CPU should have around 10M of L3 cache). • Random access memory, which is the first scalable type of memory: nowadays you can rent machines with half a terabyte of RAM on the public clouds. This is the one where most of your working data is supposed to be stored. The CPU cache system has an important concept of a cache line, which is the basic unit of data transfer between the CPU and the RAM. The size of a cache line is 64 bytes on most architectures, meaning that all main memory is divided into blocks of 64 bytes, and whenever you request (read or write) a single byte, you are also fetching all its 63 cache line neighbors whether your want them or not. Caching on the CPU level happens automatically based on the last access times of cache lines. When accessed, the contents of a cache line are emplaced onto the lowest cache layer, and then gradually evicted to a lower levels unless accessed again in time. The programmer can’t control this process explicitly, but it is worthwhile to study how it works in detail, which we will do later in this chapter. Caching is done not with a separate chip, but is embedded in the CPU itself. There are also multi-socket systems that support installing multiple CPUs in the motherboard. In this case, they have separate caching systems, and more over, each socket often becomes local to a certain part of the main memory and thus has increased latency (~100ns) for accessing locations outside of it. Such architectures are called NUMA (“Non-Uniform Memory Access”) and used as a way to increase the total amount of RAM. We will not consider them for now, but they will become important in the context of parallel computing. There are other caches inside CPUs that are used for something other than data. Instructions are fetched from memory roughly the same way that the data is fetched, so it is important not to wait for the instructions to load. For this reason, CPUs also have instruction cache, which, as the name suggests, is used for caching instructions that are read from the main memory. Its size and performance are about the same as for the L1 cache, and since it is not large, it makes sense to make binaries small in size so that the CPU does not “starve” from not being to fetch instructions in time. ### Non-Volatile Memory While the data cells in CPU caches and the RAM only gently store just a few electrons (that periodically leak and need to be periodically refreshed), the data cells in non-volatile memory types store hundreds of them. This lets the data to be persisted for prolonged periods of time without power, but comes at the cost of performance and durability — because when you have more electrons, you also have more opportunities for them colliding with silicon atoms. There are many ways to store data in a persistent way, but these are the main ones from a programmer’s perspective: • Solid state drives. These have relatively low latency on the order of 0.1ms ($10^5\$ ns), but they also have high cost, amplified by the fact that they have limited lifespans as each cell can only be written to a limited number of times. This is what mobile devices and most laptops use, because they are compact and have no moving parts.
• Hard disk drives are unusual because they are actually rotating physical disks with a read/write head attached to them. To read a memory location, you need to wait until the disk rotates to the right position and then very precisely move the head to it. This results in some very weird access patterns where reading one byte randomly may take the same time as reading the next 1MB of data — which is usually on the order of milliseconds. Since this is the only part of a computer, except for the cooling system, that has mechanically moving parts, hard disks break quite often (with the average lifespan of ~3 years for a data center HDD).
• Network-attached storage, which is the practice of using other networked devices to store data on them. There are two distinctive types. The first one is the Network File System (NFS), which is a protocol for mounting other computer’s file system over the network. The other is API-based distributed storage systems, most famously Amazon S3, that are backed by a fleet of storage-optimized machines of a public cloud, typically using cheap HDDs or some more exotic storage types internally. While NFS can can sometimes work even faster than HDD if located in the same data center, object storage in the public cloud usually has latencies of 50-100ms. They are typically highly distributed and replicated for better availability.

Since SDD/HDD are noticeably slower than RAM, everything on or below this level is usually called external memory.

Unlike the CPU caches, external memory can be explicitly controlled. This is useful in many cases, but most programmers just want to abstract away from it and use it as an extension of the main memory, and operating systems have the capability to do so by the virtue of memory paging.

Modern operating systems give every process the impression that it is working with large, contiguous sections of memory, called virtual memory. Physically, the memory allocated to each process may be dispersed across different areas of physical memory, or may have been moved to another storage such as SSD or HDD.

Do achieve this, the address space of the virtual memory is divided into pages (typically 4KB in size), and the memory system maintains a separate hardware data structure called page table, which points to where the data is physically stored for each page. When a process requests access to data in its memory, the operating system maps the virtual address to the physical address through the page table and forwards the read/write request to where that data is actually stored.

Since the address translation needs to be done for each memory request, this process is also cached with what’s called translation lookaside buffer (TLB), which is just a very small cache for physical page addresses. When it doesn’t hit, you essentially pay double the cost of a memory access. For this reason, some operating systems have support for larger pages (~2MB).

This mechanism allows using external memory quite transparently. Operating systems have two basic mechanisms:

• Swap files, which let the operating system automatically use parts of an SDD or an HDD as an extension of RAM when there is not enough real RAM.
• Memory mapping, which lets you open a file a use its contents as if they were in the main memory.

This essentially turns your RAM into “L4 cache” for the external memory, which is a good way to reason about it.

1. Pricing information is taken from Google Cloud Platform. ↩

2. Cloud storage typically has multiple tiers, becoming progressively cheaper if you access the data less frequently. ↩


text:
# In Andhra bank, a man deposited Rs. 10000 for 2 years at the rate of interest 12% at compound annually, find the amount.

1. 13442
2. 12544
3. 12644
4. 14444

Option 2 : 12544

## Detailed Solution

Given:

Principal = Rs. 10000

Time = 2 years

Rate = 12%

Formula used:

A = P × (1 + R/100)T

Where, A = Amount, P = Principal, T = Time, R = Rate of interest

Calculation:

A = P × (1 + R/100)T

A = 10000 × (1 + 12/100)2

⇒ A = 10000 × (28/25) × (28/25)

⇒ A = Rs. 12544

∴ The amount is Rs. 12544