# Generate the characters of “Hello, world!” mathematically, without strings or arrays, like generating the digits of π [duplicate]

The challenge is to come up with a mathematical way to generate each character of the exact string:

Hello, world!

(Capital letter, comma, exclamation mark.)

But you can't use any strings, arrays, or equivalents, to contain the data of the text. You must derive the characters by mathematical means.

So just a list or array of characters or ASCII codes or numbers trivially offset or inverted or shifted does not count. Nor does downloading it from an external resource or taking user input. Nor does starting with a large number which is just each ASCII codes shifted and ORed together, etc.

You can use any programming language, any mathematical functions, math libraries, etc.

The characters can of course be strings as you generate them.

Think of something like generating the digits of π.

The winner shall be the one with the most cleverness and/or elegance. The relevant weightings of cleverness and elegance are up to your peers, for the winner shall be decided by voting. (Finding a loophole in my poor problem statement shall not be regarded as clever d-:)

I think you can get the jist so don't cheat and if I should make it clearer or close some loopholes then please comment.

• @xfix: Well why did that not show up in related or when I was looking for something similar )-: Then again there seem to be lots of strings and arrays in the previous question, so maybe mine is different enough? – hippietrail Jan 25 '14 at 20:42
• All the answers I've check so far for the previous question don't pass my (intended) rules though it's true our question titles are very similar I think the "meat" of the questions is pretty different after all. – hippietrail Jan 25 '14 at 20:48
• @xfix: I reworded the title to highlight that I'm looking for something like generating the digits of pi, and specifically not the packing/unpacking type of solutions submitted for the earlier question. – hippietrail Jan 25 '14 at 20:55
• @hippietrail what makes that a programming puzzle (and not a mathematics puzzle)? And the same issues as in the question xfix linked applies, like how to encode letters etc. – FireFly Jan 25 '14 at 21:03
• stavros.io/posts/printing-hello-world-using-curve-fitting – marinus Jan 25 '14 at 21:52

## HQ9+

H


If you need more mathematics, H+++++++++++++++++++++++++++++++++++++++++ should suffice.

• The +s make it funny but the HQ9+ output doesn't match Hello, world! and is counted as trying to find a loophole outside the spirit of the question. – hippietrail Jan 26 '14 at 3:10
• You must use the official interpreter. – Timtech Jan 26 '14 at 12:58

# Javascript

String.fromCharCode(72)+(681180).toString(36)+String.fromCharCode(44)+String.fromCharCode(32)+(54903217).toString(36)+String.fromCharCode(33)


It uses a few ASCII codes, but not for most of the text.

• It looks like the string is already encoded in the numeric literals, which is what I was trying to avoid, but I admit I don't fully understand it. – hippietrail Jan 25 '14 at 20:58
• It treats lowercase letters as digits in base 36, then converts 681180_base10 to ello_base36 and 54903217_base10 to world_base36. – Remy Jan 25 '14 at 21:50
• Ah yes, I've been away from JS for a while and forgot about the base thing. – hippietrail Jan 25 '14 at 21:55

## Brainfuck

-[------->+<]>-.-[->+++++<]>++.+++++++..+++.[->+++++<]>+.------------.--[->++++<]>-.--------.+++.------.--------.-[--->+<]>.

• Could you include some explanation of how it works? – hippietrail Jan 26 '14 at 3:10
• It calculates the ASCII codes of Hello, world! and outputs them. – Timtech Jan 26 '14 at 12:59
• Oh then I assume the calculation must be inverse hyperbolic cotangent of course. And outputs them in groups of three. – hippietrail Jan 26 '14 at 15:59
• Yeah, just like the title says. – Timtech Jan 26 '14 at 18:29