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
```

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.

vamsikrishna55 | 122 |

UrGuru | 117 |

Vagesh Verma | 112 |

chaolinyu | 96 |

Akhil varma | 93 |

abducodes | 634 |

harshtyagi36 | 302 |

highway_to_hell | 252 |

rajeswarii | 248 |

Akhil varma | 246 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.