Baseline Bit Manipulation · Advanced Maths O(sqrt(n)) · O(1) beyond the output
A refinery logs each blend by an integer code, and compliance wants the blend's base oils — the distinct primes that multiply into it. The chemist strips each candidate factor out completely (dividing it away with all its powers) before moving to the next candidate, so no composite ever pretends to be a base. Anything still standing after the square-root sweep is itself a large base oil.
Input: An integer n greater than 1.
Output: The distinct prime factors of n in increasing order.
2 <= n <= 10^9Input: {"n":100}
Output: [2,5]
100 = 2^2 * 5^2; only the distinct bases 2 and 5 are reported.
Input: {"n":13}
Output: [13]
A prime blend is its own single base oil.