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.

  • \$\begingroup\$ @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? \$\endgroup\$ Jan 25 '14 at 20:42
  • \$\begingroup\$ 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. \$\endgroup\$ Jan 25 '14 at 20:48
  • \$\begingroup\$ @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. \$\endgroup\$ Jan 25 '14 at 20:55
  • \$\begingroup\$ @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. \$\endgroup\$
    – FireFly
    Jan 25 '14 at 21:03
  • 1
    \$\begingroup\$ stavros.io/posts/printing-hello-world-using-curve-fitting \$\endgroup\$
    – marinus
    Jan 25 '14 at 21:52



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

  • \$\begingroup\$ 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. \$\endgroup\$ Jan 26 '14 at 3:10
  • 3
    \$\begingroup\$ You must use the official interpreter. \$\endgroup\$
    – Timtech
    Jan 26 '14 at 12:58



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

  • \$\begingroup\$ 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. \$\endgroup\$ Jan 25 '14 at 20:58
  • 1
    \$\begingroup\$ It treats lowercase letters as digits in base 36, then converts 681180_base10 to ello_base36 and 54903217_base10 to world_base36. \$\endgroup\$
    – Remy
    Jan 25 '14 at 21:50
  • \$\begingroup\$ Ah yes, I've been away from JS for a while and forgot about the base thing. \$\endgroup\$ Jan 25 '14 at 21:55


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.