The classical closed form of the nth
fibonacci number is
$$x_{n}=\frac{(1+5^{1/2})^{n} -(1-5^{1/2})^n}{\sqrt{5}2^n}$$
But is there any way to compute it with only integer operations
? By that, I mean no intermediate result has a fractional part (e.g. 1.222). So this would rule out the square root of 5. But if a new formula involved square roots on square integers, then this is allowed.
I'm pretty sure there's not based on what I've read so far. But since this is math question, what is the proof that such a formula does not exist?
In additional, I'm aware of some ways to compute it with integer operations such as matrix exponentiation and fast doubling technique. I consider these techniques involve integer operations
but aren't closed forms. It's kind of controversial though for the matrix exponentiation case because of the exponentiation. But let's assume that exponeniation on integers is O(1) (suggesting closed-form) and on matrix is non-constant time.
Since I think closed-form is kind of unspecific. Let me be specific for our ease, this means at the minimum*:
- Integer arithmetic (add, sub, mul, div)
- Integer roots
- Integer powers
And if it's not possible with just that, I feel like these additional operations would still fit albeit loosely:
- Factorial
- Binomial Coefficient
I am not trying to ask two questions. The real question is what's the "most closed-form"
I could get, with the first three rules being a priority.
*In case I forgot some operations on integers that are necessary, please let me know.