Form a list using prime numbers You have been given N piles of coins. You have decided to divide each of those B1, B2, ..., BN piles among separate groups of people. The amount of people receiving coins has to be a prime number and the amount of money given to each person must be different in each pile.

Input: N, B1, B2, ..., BN (The amount of coins in each individual pile).

Output: NP1, NP2, ..., NPN with NP being the number of people(prime number) receiving the coins. If this is impossible then yield some unachievable result (like 0, -1, None, [], or "impossible") or raise an error.

Example:

3
7 8 9


Output: 7 2 3

Because 7 is the only prime number that can divide 7 evenly, the same for 8 and 2 and 9 and 3. Also, notice that (7 / 7 = 1) ≠ (8 / 2 = 4) ≠ (9 / 3 = 3).
05AB1E, 13 bytes

Ò.»â€˜ʒ÷DÙQ}θ


Try it online!

A port of my Pyth answer.


Ò gets the prime factÒrs of each.
.» folds a dyadic command, â (cârtesiân product) between each two elements in the list from right to left with opposite right/left operands.
€˜ flattens €ach.
ʒ...} filtʒrs those which satisfy the following condition:


÷ pairwise integer division with the input.
D Duplicate (pushes two copies of the item to the stack).
Ù removes duplicate elements, keeping a ÙniqÙe occurrence of each element.
Q checks for eQuality.

θ gets the last element.