Almost Prime Numbers
Submissions: 1136   Accuracy:

22.73%

  Difficulty: Easy   Marks: 2

 A no is said to be  k-Almost Prime Number if it  has exactly k prime factors (not necessary distinct). Your task is to complete the function printKAlmostPrimes which takes two argument k and N and prints the  first N numbers that are k prime. 


Input:
The first line of input is the no of test cases . Then T test cases follow . Each test case contains two integers k and N .

Output:
For each test case output will be N space separated first N numbers that are k prime numbers.

Constraints:
1<=T<=100
1<=k<=10
1<=N<=50

Example(To be used only for expected output):
Input

1
2 5

Output
4 6 9 10 14

Explanation
In above test case
4 has two prime factors, 2 x 2
6 has two prime factors, 2 x 3
Similarly, 9(3 x 3), 10(2 x 5) and 14(2 x 7)

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Amit Khandelwal, Harshit Sidhwa
Author: Shubham Joshi 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.