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.

makeitdonesolo | 320 |

Bishnu Dev Panda | 297 |

lost_found | 242 |

shubhamgaur_32 | 235 |

leo_messi | 229 |

Bishnu Dev Panda | 723 |

yk12 | 512 |

DevMittal | 472 |

okayboss | 456 |

VijethaShastri | 431 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4921 |

Quandray | 4547 |

Login to report an issue on this page.