21
4
Write functions x(a)
, y(a)
and z(a)
such that for any rational a
all functions return rational numbers and x(a)*y(a)*z(a)*(x(a) + y(a) + z(a)) == a
. You may assume a ≥ 0.
You do not need to use rational types or operations in your program, as long as your program is mathematically sound. E.g. if you use a square root in your answer you must show that its argument is always a square of a rational number.
You may write three named functions x, y, z or write three programs instead if functions are cumbersome or nonexistent for your language. Alternatively you may also write a single program/function that returns three numbers x, y, z. Finally, if you so prefer you may input/output the rational numbers as a pair of numerator/denominator. Your score is the total size of the three functions or three programs in bytes. Smallest score wins.
Brute forcing is not allowed. For any a = p/q where p, q ≤ 1000 your program should run in under 10 seconds.
An example (this does not mean your decomposition has to give these numbers):
x = 9408/43615
y = 12675/37576
z = 1342/390
x*y*z*(x+y+z) = 1
Can we write one function which outputs all of them together (say, in an array)? – Leaky Nun – 2017-04-28T12:20:07.090
Can we input the numerator and the denominator as two numbers? – Leaky Nun – 2017-04-28T12:21:22.877
@LeakyNun Yes and yes. – orlp – 2017-04-28T12:40:30.037
1Is it provably doable for any
a
? – Fatalize – 2017-04-28T13:12:21.413@Fatalize I wouldn't have made this challenge otherwise.
– orlp – 2017-04-28T13:20:13.1602I assume you don't want to show a proof because it would give away a solution, but your word is not really a proof. – Fatalize – 2017-04-28T13:25:29.320
@Fatalize, I think this was inspired by a recent answer to a question on another stack, which mentions that Euler exhibited a triple of such functions in a letter to Goldbach. – Peter Taylor – 2017-04-28T15:45:30.397
I assume on the basis of the example and the lack of explicit statement otherwise that the output (numerator, denominator) don't have to be coprime? – Peter Taylor – 2017-04-28T17:04:45.857
@PeterTaylor Correct, the fraction doesn't have to be reduced. In fact, your answer can use floating point if you so desire, just your answer needs to be mathematically sound. If a rational type would get input into your function it should still function correctly (even if your language of choice doesn't actually have a rational type). – orlp – 2017-04-28T17:27:19.640