You are given an integer $$$n$$$, and you need to construct an array $$$a$$$ of size $$$n$$$ satisfying:
The first line contains a single integer $$$t$$$ ($$$1 \le t\le 10^3$$$), the number of test cases.
The only line of each test case contains an integer $$$n$$$ ($$$1\le n\le 10^5$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases will not exceed $$$10^5$$$.
For each test case, output $$$n$$$ integers — the array you construct.
If there are multiple solutions, print any of them.
3234
2 3 5 3 2 2 3 5 7
The Fibonacci sequence, where each number is the sum of the two preceding ones, is well-known in mathematics. Consider a sequence $$$a$$$ that follows a similar pattern but with subtraction instead of addition.
Given three integers $$$n$$$, $$$a_1$$$, and $$$a_2$$$. For $$$i \geq 3$$$, $$$a_i = a_{i-1} - a_{i-2}$$$.
Your task is to find
$$$$$$\sum_{i = 1}^{n} a_i \mod (10^9 + 7)$$$$$$
The input begins with a single integer $$$t$$$ $$$(1 \leq t \leq 10^5)$$$, the number of test cases.
Each of the next $$$t$$$ lines contains three integers $$$n$$$, $$$a_1$$$, and $$$a_2$$$ $$$(1 \leq n, a_1, a_2 \leq 10^9)$$$.
For each test case, output the answer.
63 2 54 1 21 1 13 10 3799843967 796619138 4461736071000000000 1000000000 1000000000
10 3 1 6 649554476 1000000000
You are given two integers $$$k$$$, $$$n$$$ and a polynomial $$$P(x) = a_0+a_1x+a_2x^2+....+a_nx^n$$$.
Note
Your task is to find the value of total sum of the coefficients of $$$P^k(x)$$$ modulo $$$(10^9 + 7)$$$.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 2 \cdot 10^4)$$$. The description of the test cases follows.
The first line of each test case contains $$$2$$$ integers $$$k$$$ $$$(1 \leq k \leq 2 \cdot 10^5)$$$ and $$$n$$$ $$$(0 \leq n \leq 2 \cdot 10^5)$$$.
The next line will contain $$$n+1$$$ integers $$$a_0,a_1,...,a_n$$$ $$$(-10^{9} \leq a_i \leq 10^{9})$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases will not exceed $$$2 \cdot 10^5$$$. However, there is no limit to the sum of $$$k$$$.
For each test case, print the sum modulo $$$(10^9 + 7)$$$.
41 11 12 15 32 1-2 -22003 3-1 4 -2 1
2 64 16 993748093
In the first test, $$$P(x) = 1+x$$$. The sum of its coefficients is $$$1+1 = 2.$$$
In the second test, $$$P(x) = 5+3x$$$. We can get $$$P^{2}(x) = P(x) \cdot P(x) = 25+30x+9x^2$$$. The sum of its coefficients is $$$25+30+9 = 64$$$.
There is an array $$$a$$$. Initially, $$$a = [0]$$$.
Assume that you can perform several operations. In the $$$i$$$-th operation, you can do exactly one of the following two operations:
You are given $$$q$$$ independent queries. For each query, you are given three integers $$$x$$$, $$$l$$$, and $$$r$$$ ($$$1 \leq$$$ $$$\boldsymbol{x \leq l}$$$ $$$\leq r$$$). Your task is to count the number of distinct arrays $$$a$$$ that satisfy the following conditions:
Since the answers may be large, you need to output them modulo $$$998\,244\,353$$$.
The first line contains an integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries.
Next, there are $$$q$$$ lines, each containing three space-separated integers $$$x$$$, $$$l$$$, and $$$r$$$ ($$$1 \leq \boldsymbol{x \leq l}$$$ $$$\leq r\le 10^6$$$).
For each query, output the answer modulo $$$998\,244\,353$$$ on a new line.
61 1 11 1 22 2 33 4 5800000 900000 10000001000000 1000000 1000000
2 6 20 384 146046122 463285462
In the first test case, all the $$$2$$$ possible arrays are:
In the second test case, all the $$$6$$$ possible arrays are:
Given $$$a_1$$$ and $$$n$$$, find the number of sequences of positive integers $$$a_2, a_3, \dots, a_n$$$ that satisfy the following condition:
$$$$$$ \frac{\operatorname{lcm}(a_1, a_2, \ldots, a_n)}{\gcd(a_1, a_2, \ldots, a_n)} = a_1 $$$$$$
Here, $$$\gcd(a_1, a_2, \dots, a_n)$$$ denotes the greatest common divisor, which is the largest positive integer that divides each number in the sequence, and $$$\operatorname{lcm}(a_1, a_2, \dots, a_n)$$$ denotes the least common multiple, which is the smallest positive integer that is divisible by each number in the sequence.
Since the answer can be large, output it modulo $$$998\,244\,353$$$. It can be proven that the answer is finite.
The first line contains a single integer $$$t$$$ $$$(1\le t\le 1000)$$$ — the number of test cases.
The only line of each test case consists of two integers $$$a_1$$$ and $$$n$$$ ($$$2 \le a_1,n \le 10^9$$$).
For each test case, output the number of sequences satisfying the condition above modulo $$$998\,244\,353$$$.
42 34 3666 9991000000000 1000000000
6 12 15861573 208999360
In the first test case, all the $$$6$$$ valid sequences are $$$[2,1,1],[2,1,2],$$$ $$$[2,2,1],[2,2,4],[2,4,2],$$$ and $$$[2,4,4]$$$.
You are given two polynomials $$$f(x) = Ax + B$$$ and $$$g(x) = Cx^n + Dx^{n-1}$$$. Your task is to find the minimum integer $$$k$$$, such that $$$g^{(k)}(x)$$$ is divisible by $$$f(x)$$$.
Here, $$$g^{(k)}(x)$$$ represents taking the derivative of $$$g(x)$$$ exactly $$$k$$$ times.
Formally,
and
where $$$E$$$, $$$F$$$, and $$$G$$$ are constants.
For example, for $$$g(x) = x^3 + 3x^2$$$, we can find that:
We say that a polynomial $$$P_1(x)$$$ is divisible by $$$P_2(x)$$$ if and only if there exists a polynomial $$$Q(x)$$$ such that $$$P_1(x) = Q(x)P_2(x)$$$, where the coefficients of $$$Q$$$ are integers.
The first line contains one positive integer $$$t$$$ ($$$1\leq t \leq 10^5$$$) — the number of test cases.
Each test case consists of one line which contains $$$5$$$ integers $$$A,B,C,D,n$$$ ($$$1\leq A,B,C,D,n\leq 2\cdot 10^5$$$).
For each test case, output the minimum integer $$$k$$$, such that $$$g^{(k)}(x)$$$ is divisible by $$$f(x)$$$.
61 2 2 4 14 2 3 3 42 4 1 3 32 1 5 2 4131296 123463 91609 133724 142208172458 127836 190471 141192 190476
0 2 4 5 50599 190477
In the first test case, $$$f(x)=x+2$$$ and $$$g(x)=2x+4$$$. We can see that $$$g^{(0)}(x)$$$ is divisible by $$$f(x)$$$ because $$$g^{(0)}(x)=g(x)=2x+4=2 \cdot f(x)$$$. So, the answer is $$$0$$$.
In the second test case, $$$f(x)=4x+2$$$ and $$$g(x)=3x^4+3x^3$$$. We can see that $$$k=2$$$ is the minimum integer such that $$$g^{(k)}(x)$$$ is divisible by $$$f(x)$$$ because $$$g^{(2)}(x)=36x^2+18x=9x \cdot f(x)$$$.
In the third test case, $$$f(x)=2x+4$$$ and $$$g(x)=x^3+3x^2$$$. We can see that $$$k=4$$$ is the minimum integer such that $$$g^{(k)}(x)$$$ is divisible by $$$f(x)$$$ because $$$g^{(4)}(x)=0=0 \cdot f(x)$$$.
Note that although $$$g^{(1)}(x)=3x^2+6x=\frac{2}{3}x \cdot f(x)$$$, $$$g^{(1)}(x)$$$ is not divisible by $$$f(x)$$$ since $$$\frac{2}{3}$$$ is not an integer.
You are given an array $$$a$$$ of length $$$n$$$. You can perform the following two operations any number of times, in any order:
For example, given $$$a = [1,0,1,9,1]$$$, choosing $$$a_1, a_3, a_4$$$ for operation $$$2$$$ results in $$$a=[7,0,7,7,1]$$$. However, choosing $$$a_1, a_3, a_5$$$ for operation $$$2$$$ is invalid, as their values are the same.
You want to choose a sequence of operations that maximizes the total number of operations. Find the maximum number of operations possible. Since the answer can be large, output it modulo $$$998\,244\,353$$$.
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases.
For each test case, the first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the size of the array $$$a$$$.
The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 10^6$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, output a single integer in a new line — the maximum number of operations possible modulo $$$998\,244\,353$$$.
21520 2
5 3
In the first test case, you can only choose $$$a_1$$$ for operation $$$1$$$ five times.
In the second test case, the optimal strategy is the following:
After this, we can no longer perform any of the two operations on the array.