# An algorithm which takes long time to halt

I want to find an algorithm such that

1. takes 10 inputs as natural number
2. returns 1 output as natural number between 1 and 10. (including 1 and 10)

It means it should be a function

f($x_0$, $x_1$, $x_2$, $x_3$, $x_4$, $x_5$, $x_6$, $x_7$, $x_8$, $x_9$)= n

However, the time of computation of the function should be very long. It should take about 10 minutes by modern computer. And nobody can predict the return value in short time.

Can you recommended me a good algorithm which satisfies above condition?

• For $i = 1$ until $10^{10}$, do stuff, end, output sample(uniform(1,10)).
– Ritz
Oct 30 '14 at 12:32
• I said, nobody can predict the result in short time. Oct 30 '14 at 12:35
• I edited my previous comment.
– Ritz
Oct 30 '14 at 12:36
• @WildChan Sorry. Can you help me make the question more precise? I want to say that it should be a "function". It means, for same inputs, the output should be same. Oct 30 '14 at 12:38
• Write the input numbers in base 7, concatenate. Run a couple of million iterations of SHA-2 or whatnot on it. Interpret the hash as a hexadecimal number, take the remainder modulo $10$, add $1$. Oct 30 '14 at 12:44

Convert the $x_i$ to strings, separated by ",". Then compute a good hash (for example, SHA-2) of the string and replace the first few characters by the hash. Repeat the latter very often, where the repeat count is adjusted to meet your 10 minute requirement. Then return $1+$ the hash modulo $10$.
Quick and dirty: Turn the list of numbers into a string and hash it with a cryptographic hash function (such as SHA-2). Then hash the result again. Repeat this $n$ times. Use the result hash to create a number between $1$ and $10$, e.g. with something like a checksum. Do some test runs to find a good $n$.