Quantcast
Channel: Answers for "Fibonacci Sequence Calculation"
Viewing all articles
Browse latest Browse all 8

Answer by Magnus Ahlkvist

$
0
0
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 DECLARE @i numeric(38,0); WITH Fib(Num, fib, fib2) AS ( SELECT 0 AS Expr1, cast(0 as numeric(38,0)) AS Expr2, cast(1 as numeric(38,0)) AS Expr3 UNION ALL SELECT Num + 1 AS Expr1, fib + fib2 AS Expr2, fib FROM Fib AS fib_2 WHERE (Num

Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images