9
2
Write a mathematical function that results in an integer representation of "hello world"
For example "hello world" in hex is 68656c6c6f20776f726c64
so the goal will be to write a mathematical program that results in a number representing "hello world".
Here is a example of a possible solution using python:
print(2*2*3*59*61*97*416510539*72330832279)==int("68656c6c6f20776f726c64", 16)
Any type of mathematical equations could be used, such as: powers, series, factorials, and other mathematical operations.
The rules:
You may select your own way to encode/represent "hello world" as an integer. Hash functions are also allowed
Mathematical libraries (e.g. numpy, GMP) are allowed.
The intention is to focus on the mathematics part
What is the winning criterion? – Victor Stafusa – 2014-01-04T19:50:03.137
@Victor The most creative/ingenious equation – kyle k – 2014-01-04T19:50:50.970
1Creativity is not objective. Are you thinking of [tag:popularity-contest]? – Kendall Frey – 2014-01-04T19:51:37.350
4Any integer can represent "hello world" if you are allowed to decide the encoding. e.g. -1 = "hello worlc", 0 = "hello world", 1 = "hello worle", etc. – Kendall Frey – 2014-01-04T19:52:17.683
@KendallFrey I added an answer exploiting what you are saying just to show that. – Victor Stafusa – 2014-01-04T20:41:10.503
1@kylek Since you did not specified the exact winning criteria beyond "the most creative/ingenious", i took the liberty to add the [tag:popularity-contest] as the winning criterion. – Victor Stafusa – 2014-01-04T20:42:25.820
2
(in the context of this website) all computer data and programs can be trivially represented as numbers - because that's the model the inventors (Babbage, et al) used. Also allowing any encoding really just makes this a contest of who can write the most creative program that yields a number. There is an implication that the source code should use "mathematical operations", but anything a program does can be modeled as a math op. Suggest you require ASCII encoding and then make the contest about representing it as a "special number" See: http://www2.stetson.edu/~efriedma/numbers.html
– user2460798 – 2014-01-04T21:05:12.417Shouldn't the function by which a number is produced by "hello world" be invertible, such that, if you receive the number and apply the inverse, "hello world" is output? – DavidC – 2014-01-04T21:14:26.687
@DavidCarraher yes it should – kyle k – 2014-01-04T21:19:02.253
1You are playing extremely fast and loose with your mathematical terminology. You are using "equation" and "function" seemingly interchangeably. I think the word you were looking for is "expression". But even then, the question is not well posed. The mathematical encoding for "hello world" I choose for mine is the original K&R hello world source code. Oh, hey, it works! – Tim Seguine – 2014-01-04T22:26:55.317
@Tim I am also a little bit confused about the proper way to describe my question. – kyle k – 2014-01-04T22:29:05.243
1
Here's a guy who wrote an actual mathematical formula where f(0)='H', f(1)='e' etc. http://www.stavros.io/posts/printing-hello-world-using-curve-fitting/
– marinus – 2014-01-06T01:02:55.843