3 ms·
Here is another method I wrote where you compute in the Q[√5] field. It can be modified to work over Z[√5] as well: http://ideone.com/NWQe38 http://ideone.com/
by jordigh 11y ago
Here is another method I wrote where you compute in the Q[√5] field. It can be modified to work over Z[√5] as well:
http://ideone.com/NWQe38 http://ideone.com/NWQe38
- xyzzyz 11y agoI implemented the same in Haskell a while ago: https://github.com/xyzzyz/FibBinet/blob/master/FibBinet.hs https://github.com/xyzzyz/FibBinet/blob/master/FibBinet.hs With yours, both make interesting comparison of how similar problem is solved in different languages.
- eru 11y agoWhy did you define both negate and (-)?
- xyzzyz 11y agoI don't know. I probably shouldn't have. I accept pull requests.
- panic 11y agoIn Haskell you can use Data.Real.Constructible (http://hackage.haskell.org/package/constructible http://hackage.haskell.org/package/constructible) to compute exactly with arbitrary square roots.