Six Equations
InterviewTime limit1sMemory limit128 MB
Recover six bounded primes from six pairwise products by taking gcds of the pairs that share a prime.
- Level
Easy3 of 10
- Topics
- Number theory
- Solved
- No attempts yet
Problem
Six simple equations are given. The unknowns , , , , , are all primes that are at least 2 and at most 20,000,000.
Every through is a positive integer that does not exceed 20,000,000 squared. The values and are fixed by the two equations above. Nothing requires them to be prime, and they are not printed.
Given , , , , , , write a program that finds , , , , , . Only inputs that have a solution are given.
Input
The first line contains , , , , , separated by spaces. Here and .
Output
Print , , , , , in this order on one line, separated by single spaces. Because and , the six values are determined uniquely.