Write program which verifies Erdős–Straus conjecture Write program, which verifies Erdős–Straus conjecture.
Program should take as input one integern (3 &lt;= n &lt;= 1 000 000) and print triple of integers satisfying identity 4/n = 1/x + 1/y + 1/z, 0 &lt; x &lt; y &lt; z.

Shortest code wins.

Some examples:

3 =&gt; {1, 4, 12}
4 =&gt; {2, 3, 6}
5 =&gt; {2, 4, 20}
1009 =&gt; {253, 85096, 1974822872}
999983 =&gt; {249996, 249991750069, 62495875102311369754692}
1000000 =&gt; {500000, 750000, 1500000}


Note that your program may print other results for these numbers because there are multiple solutions.
Ruby, 119 106 characters
f=-&gt;s,c,a{m=s.to_i;c&lt;2?m&lt;s||(p a+[m];exit):(1+m...c*s).map{|k|f[s/(1-s/k),c-1,a+[k]]}}
f[gets.to_r/4,3,[]]

The code uses minimal bounds for each variable, e.g. n/4&lt;x&lt;3n/4, similarly for y. Even the last example returns instantaneous (try here).
Examples:
&gt; 12
[4, 13, 156]

&gt; 123
[31, 3814, 14542782]

&gt; 1234
[309, 190654, 36348757062]

&gt; 40881241801
[10220310451, 139272994276206121600, 22828913614743204775214996005450198400]