Divisor Count
Divisor Count
In this problem, you have to find the first n integers that have exactly k divisors.
A divisor of an integer a is an integer b such that the quotient a / b is also an integer.
Given n and k, find the first n positive integers which have exactly k distinct positive integer divisors and are not greater than 1018
. If the total number of such integers is less than n, find all of them.
Input
Two integers n and k (1 ≤ n, k ≤ 110 000) - the number of integers to find and the required number of divisors.
Output
Print n integers, each on a separate line: the first n positive integers which have exactly k distinct positive integer divisors and are not greater than 1018
, in increasing order. If there are m < n such integers, print the number -1 in each of the remaining n - m lines.
5 4
6 8 10 14 15
4 29
268435456 22876792454961 -1 -1
Example description: In the first test case you have to print the first five integers with exactly four divisors. These are 6 (divisors 1, 2, 3 and 6), 8 (divisors 1, 2, 4 and 8), 10 (divisors 1, 2, 5 and 10), 14 (divisors 1, 2, 7 and 14) and 15 (divisors 1, 3, 5 and 15).