SP25067 FIBPOL - Fibonacci Polynomial
Description
Let **F(n)** be the **_n $ ^{th} $ member of the_ Fibonacci sequence**:
```
```
F(0) = 0, F(1) = 1,
F(n) = F(n-1)+F(n-2) (n > 1)
```
```
Consider the following Fibonacci polynomial:
A(x) = x F(1) + x $ ^{2} $ F(2) + x $ ^{3} $ F(3) + ... + x $ ^{n} $ F(n) + ....
= sigma(n = 0 to infinity) x $ ^{n} $ F(n)
Amazingly,
A(1/2) = 1/2 + 1/2 $ ^{2} $ + 2/2 $ ^{3} $ + 3/2 $ ^{4} $ + .... + F(n)/2 $ ^{n} $ + ... = 2
In this problem, we only considering the non-negative-integer value of `A(x)`. Here are some examples of `A(x)` for specific `x`.
xA(x) 0 0 sqrt(2)-1 1 1/2 2 \[sqrt(13)-2\]/3 3 \[sqrt(89)-5\]/8 4Find out if `x` is rational with the given value of `A(x)`
Input Format
The first line contains T, the number of test cases. The next T lines contains the value of A(x).
- `0
Output Format
- `1 if the given Ax yeilds a rational x, 0 otherwise`