Given a number N, print least prime factors for all numbers from 1 to N. The least prime factor of an integer N is the smallest prime number that divides it. The least prime factor of all even numbers is 2. A prime number is its own least prime factor (as well as its own greatest prime factor).

**Note : **1 needs to be printed for 1.

```
Input: N = 6
Output: 1 2 3 2 5 2
```

**Input:**

The first line of input contains an integer T denoting the number of test cases.The first line of each test case is N.

**Output:**

Print least prime factors separated by space

**Constraints:**

1 ≤ T ≤ 200

2 ≤ N ≤ 1000

**Example:**

**Input:**

2

6

10

**Output:**

1 2 3 2 5 2

1 2 3 2 5 2 7 2 3 2

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.

mantan_g | 267 |

tushki | 198 |

aksht7 | 182 |

ayush1101 | 128 |

namansharmacse17 | 110 |

ARUN_PUNDIR | 730 |

manishgupta8497 | 627 |

AMAN__JAIN | 625 |

Abhimanyu_kumar | 562 |

AJ786 | 541 |

blackshadows | 5335 |

Ibrahim Nash | 5223 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4584 |

Login to report an issue on this page.