Quantcast
Channel: Answers for "Fibonacci Sequence Calculation"
Browsing index pages (8 articles)

Answer by Magnus Ahlkvist

I think Fib(182) is as far as one can go with SQL Server. I used the answer from @Pavel Pawlowski to create a Fib-function to test it. CREATE FUNCTION dbo.Fib(@n int) RETURNS numeric(38,0) AS BEGIN...

View Article


Answer by KenJ

Here's one from [BeyondRelational][1] that is good for the 1st 70 numbers. It succumbs to rounding errors after that, so I limited the output. SELECT FLOOR(POWER(( 1 + SQRT(5) ) / 2.0, number) /...

View Article


Answer by Pavel Pawlowski

Here is a very nice solution which uses CTE, not from my head but found it on SQL Server Central: [Fibonacci Sequence CTE][1]. I've only slightly altered it to return the maximum sequence which fits to...

View Article

Answer by Tim

This is the easiest way for me. Simply plug in your values into the parameters. I started with 1 and 1 like your example. DELCARE @Y INT DECLARE @Z INT DECLARE @FIB INT SET @Y = 1 SET @Z = 1 SET @FIB =...

View Article

Answer by Magnus Ahlkvist

I think Fib(182) is as far as one can go with SQL Server. I used the answer from @Pavel Pawlowski to create a Fib-function to test it. CREATE FUNCTION dbo.Fib(@n int) RETURNS numeric(38,0) AS BEGIN...

View Article


Answer by KenJ

Here's one from [BeyondRelational][1] that is good for the 1st 70 numbers. It succumbs to rounding errors after that, so I limited the output. SELECT FLOOR(POWER(( 1 + SQRT(5) ) / 2.0, number) /...

View Article

Answer by Pavel Pawlowski

Here is a very nice solution which uses CTE, not from my head but found it on SQL Server Central: [Fibonacci Sequence CTE][1]. I've only slightly altered it to return the maximum sequence which fits to...

View Article

Answer by Tim

This is the easiest way for me. Simply plug in your values into the parameters. I started with 1 and 1 like your example. DELCARE @Y INT DECLARE @Z INT DECLARE @FIB INT SET @Y = 1 SET @Z = 1 SET @FIB =...

View Article

Browsing index pages (8 articles)


Latest Images