See following the two recursive functions:
C(0) = 0
C(1) = 5
C(K) = C(K-1) + 4
F(0) = 1
F(1) = 2
F(N) = F(N-1) + C(N-1)
Now you are given N, you have to find the value of $F(N)$
.
Input starts with an integer $T$
($0 < T \le 1000000$
), denoting the number of test cases. Each test case contains an integer $N$
($0 \le N \le 1000000000$
).
For each test case, print the value of $F(N)$
. The value of $F(N)$
fits in 64-bit signed integer.
Input | Output |
---|---|
2 3 5 | 16 46 |
This problem was authored for CodeMask Championship 2016 and is being hosted on Toph per organizer’s request.