Codeforces Round 1067 (Div. 2)
F1
Distinct GCDs (Easy Version)
Codeforces
2600
原题
← EF2 →
翻译中…

This is the easy version of the problem. The difference between the versions is that in this version, $n \leq 700$. You can hack only if you solved all versions of this problem.

翻译中…

Legend has it that when Gauss was a young schoolboy, his teacher tasked the class with summing the integers from $1$ to $100$, likely as a way to keep them occupied for a while. However, young Gauss quickly came up with the formula $\text{sum} = \frac{n(n+1)}{2}$ and found the answer in mere moments. Centuries later, Gauss appears before you in a nightmare with a daunting task...

翻译中…

You are given a positive integer $n$, find a sequence of integers $[a_1, a_2, \ldots, a_n]$ such that $1 \leq a_i \leq 10^{18}$ for all $1 \leq i \leq n$, and the GCDs of pairwise adjacent elements of $a$ are all distinct. Formally,

翻译中…

$\gcd(a_i, a_{i+1}) \neq \gcd(a_j, a_{j+1})$ for each $1 \leq i \lt j \lt n$

翻译中…

Additionally, $a$ should have the minimum possible number of distinct elements.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 200$). The description of the test cases follows.

翻译中…

The first and only line of each test case contains a single integer $n$ ($2 \leq n \leq 700$) — the size of the sequence to be found.

翻译中…

Output

翻译中…

For each test case, output $n$ space-separated positive integers $a_1, a_2, \ldots, a_n$ ($1 \leq a_i \leq 10^{18}$) on a new line that satisfy the condition in the statement. If there are multiple solutions, print any of them.

翻译中…

It can be proven that under the problem constraints, a solution always exists.

翻译中…

Note

翻译中…

For the second test case, the GCDs of adjacent elements are $[\gcd(1, 4), \gcd(4, 4), \gcd(4, 6), \gcd(6, 6)] = [1, 4, 2, 6]$, all of which are distinct.

翻译中…

For the third test case, the GCDs of adjacent elements are $[\gcd(4, 4), \gcd(4, 6), \gcd(6, 6), \gcd(6, 9), \gcd(9, 9), \gcd(9, 4)] = [4, 2, 6, 3, 9, 1]$, all of which are distinct.

翻译中…

For each test case, it can be proven that no sequence with fewer distinct elements exists such that all adjacent GCDs are distinct.

翻译中…

样例

Input #1
3
2
5
7
Output #1
2 2
1 4 4 6 6
4 4 6 6 9 9 4
InputCopy OutputCopy
题目信息
题号
2158F1
时间限制
2 s
内存限制
256 MB
标签
构造
图论
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。