Prime Factorization using Sieve

Advanced Maths DSA practice problem on Onlearn.

Difficulty: medium.

Topics: Find Prime Factorisation of a Number using Sieve, Prime Numbers, Sieve of Eratosthenes, Mathematical Algorithms, Time Complexity, Space Complexity, Arrays, Loops, preprocessing, number theory algorithms, number theory, Sieve of Eratosthenes, Divisors & Factors.

Prime Factorization using Sieve Problem Statement Given an integer N, find its prime factorization. The prime factors should be listed in non decreasing order. Input Specification The input consists of a single integer N. Output Specification Output the prime factors of N, separated by spaces. Constraints 1 <= N <= 10^6 Sample Test Cases Sample Input 1 12 Sample Output 1 2 2 3 Sample Input 2 100 Sample Output 2 2 2 5 5 Sample Input 3 7 Sample Output 3 7