Solving Three Open Problems with a Halting Oracle You are given the functions: h1(f,*args) and h2(f,*args)

Both are methods which are already defined for you (here the asterisk indicates a variable number of arguments)

f is a function, *args is a list of parameters to be passed to that function

h1 returns a boolean value: True if the function f ever halts when called on *args and False if it doesn't (assuming the machine running it has infinite time and memory and that the interpreter/compiler for the language you're writing in knows how to handle infinite time and memory).

If f(*args) would ever make a call to h1 or h2, h1 throws an exception

h2 behaves exactly like h1 except that if f makes calls to h1, then h2 will not throw an exception

In as few characters as possible, write a program which takes no input and should output:

The Collatz Conjecture is {True/False}
Goldbach's Conjecture is {True/False}
The Twin Primes Conjecture is {True/False}


based on the validity of each of those conjectures.

Here are wikipedia links explaining each of the conjectures:

http://en.wikipedia.org/wiki/Collatz_conjecture

http://en.wikipedia.org/wiki/Goldbach%27s_conjecture

http://en.wikipedia.org/wiki/Twin_prime

You may assume any big integer library in whatever language you choose to use will successfully represent arbitrary large integers. In other words, we'll assume any language/library which is capable of expressing 3**(3**10) is also capable of expressing 3**(3**(3**10)) on a sufficiently beefy machine.

Obviously since it's impossible to run your program, please provide an explanation of how it works along with the code
Haskell, 242
p n=and[rem n r&gt;0|r&lt;-[2..n-1]]
c 1=1
c n|odd n=c$3*n+1|0&lt;1=c$div n 2
s!f=putStr(s++&quot; Conjecture is &quot;)&gt;&gt;print(not$h2$all(h1.f)[4..])
main=do&quot;The Collatz&quot;!c;&quot;Goldbach's&quot;! \n-&gt;or[p$n-r|r&lt;-[2..n-2],p r];&quot;The Twin Primes&quot;! \n-&gt;or[p$r+2|r&lt;-[n..],p r]

because in Haskell variables can contain not only values, but computations (this is called laziness) I let myself make h1, h2 take a single argument and return weather or not it's evaluation will halt.
somewhat ungolfed code:
h1 = undefined
h2 = undefined

prime n=and[rem n r&gt;0|r&lt;-[2..n-1]]
collatz 1=1
collatz n
    |odd n=collatz (3*n+1)
    |0&lt;1  =collatz (div n 2)
    
s!f=do
    putStr (s++&quot; Conjecture is &quot;)
    print$not$h2$all(h1.f)[4..]
    
main=do
    &quot;The Collatz&quot;!c                                         --collatz
    &quot;Goldbach's&quot;! \n-&gt;or[prime (n-r)|r&lt;-[2..n-2],prime r]   --goldbach
    &quot;The Twin Primes&quot;! \n-&gt;or[prime (r+2)|r&lt;-[n..],prime r] --twin primes

a bit of explanation:
when all is applied to an infinite list, it will halt iff one of the elements of the list is False, due to laziness (short-circuiting, for all non-Haskell folks out there). we use this to compute the collatz conjecture and the twin primes conjecture.
! packages this trickery along with printing.
the result is True when f terminates on all the numbers 4... (this doesn't matter for the collatz conjecture or the twin primes conjecture, because we already know they are true for such small numbers).
the code for the collatz conjecture is &quot;The Collatz&quot;!c. it prints &quot;The Collatz Conjecture is &quot; and the result, which is weather c terminates on all numbers 4...
the code for the goldbach conjecture is &quot;Goldbach's&quot;! \n-&gt;or[p$n-r|r&lt;-[2..n-2],p r].
\n-&gt;or[p$n-r|r&lt;-[2..],p r,r&lt;n+1] is a function which given n, if it is a sum of two primes, returns True, but otherwise loops indefinitely. thus, if it halts for every 4.. goldbach's conjecture is true.
the code for the twin primes conjecture is &quot;The Twin Primes&quot;! \n-&gt;or[p$r+2|r&lt;-[n..],p r].
\n-&gt;or[p$r+2|r&lt;-[n..],p r] is a function which given n, if there are twin primes greater than n, returns True, but otherwise loops indefinitely. thus, if it halts for every 4.. the twin prime conjecture is true.