Write program, which verifies Erdős–Straus conjecture.
Program should take as input one integern
(3 <= n <= 1 000 000
) and print triple of integers satisfying identity 4/n = 1/x + 1/y + 1/z
, 0 < x < y < z
.
Shortest code wins.
Some examples:
3 => {1, 4, 12}
4 => {2, 3, 6}
5 => {2, 4, 20}
1009 => {253, 85096, 1974822872}
999983 => {249996, 249991750069, 62495875102311369754692}
1000000 => {500000, 750000, 1500000}
Note that your program may print other results for these numbers because there are multiple solutions.
{1, 121, 169, 289, 361, 529}
modulo 840. \$\endgroup\$