login
Array read by ascending antidiagonals. Generalized Fibonacci numbers F(n, k) = (psi^(k - 1)*(phi + n) - phi^(k - 1)*(psi + n)) / (psi - phi) where phi = (1+sqrt(5))/2 and psi = (1-sqrt(5))/2. F(n, k) for n >= 0 and k >= 0.
3

%I #20 May 30 2022 08:38:01

%S 0,1,1,2,1,1,3,1,2,2,4,1,3,3,3,5,1,4,4,5,5,6,1,5,5,7,8,8,7,1,6,6,9,11,

%T 13,13,8,1,7,7,11,14,18,21,21,9,1,8,8,13,17,23,29,34,34,10,1,9,9,15,

%U 20,28,37,47,55,55,11,1,10,10,17,23,33,45,60,76,89,89

%N Array read by ascending antidiagonals. Generalized Fibonacci numbers F(n, k) = (psi^(k - 1)*(phi + n) - phi^(k - 1)*(psi + n)) / (psi - phi) where phi = (1+sqrt(5))/2 and psi = (1-sqrt(5))/2. F(n, k) for n >= 0 and k >= 0.

%C The definition declares the Fibonacci numbers for all integers n and k. It gives the classical Fibonacci numbers as F(0, n) = A000045(n). A different enumeration is given in A352744.

%H Peter Luschny, <a href="https://www.luschny.de/math/seq/oeis/FibonacciFunction.html">The Fibonacci Function</a>.

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Cassini_and_Catalan_identities">Cassini and Catalan identities</a>.

%F Functional equation extends Cassini's theorem:

%F F(n, k) = (-1)^(k - 1)*F(-n - 1, 2 - k).

%F F(n, k) = ((1 - phi)^(k - 1)*(1 - phi + n) - phi^(k - 1)*(phi + n))/(1 - 2*phi).

%F F(n, k) = n*fib(k - 1) + fib(k), where fib(n) are the classical Fibonacci numbers A000045 extended in the usual way for negative n.

%F F(n, k) - F(n-1, k) = fib(k-1).

%F F(n, k) = F(n, k-1) + F(n, k-2).

%F F(n, k) = (n*sin((k - 1)*c) - i*sin(k*c))/(i^k*sqrt(5/4)) where c = i*arcsinh(1/2) - Pi/2, for all n, k in Z. Based on a remark of Bill Gosper.

%e Array starts:

%e n\k 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...

%e --------------------------------------------------------

%e [0] 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... A000045

%e [1] 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ... A000045 (shifted once)

%e [2] 2, 1, 3, 4, 7, 11, 18, 29, 47, 76, ... A000032

%e [3] 3, 1, 4, 5, 9, 14, 23, 37, 60, 97, ... A104449

%e [4] 4, 1, 5, 6, 11, 17, 28, 45, 73, 118, ... [4] + A022095

%e [5] 5, 1, 6, 7, 13, 20, 33, 53, 86, 139, ... [5] + A022096

%e [6] 6, 1, 7, 8, 15, 23, 38, 61, 99, 160, ... [6] + A022097

%e [7] 7, 1, 8, 9, 17, 26, 43, 69, 112, 181, ... [7] + A022098

%e [8] 8, 1, 9, 10, 19, 29, 48, 77, 125, 202, ... [8] + A022099

%e [9] 9, 1, 10, 11, 21, 32, 53, 85, 138, 223, ... [9] + A022100

%p f := n -> combinat:-fibonacci(n): F := (n, k) -> n*f(k - 1) + f(k):

%p seq(seq(F(n - k, k), k = 0..n), n = 0..11);

%p # The next implementation is for illustration only but is not recommended

%p # as it relies on floating point arithmetic. Illustrates the case n,k < 0.

%p phi := (1 + sqrt(5))/2: psi := (1 - sqrt(5))/2:

%p F := (n, k) -> (psi^(k-1)*(psi + n) - phi^(k-1)*(phi + n)) / (psi - phi):

%p for n from -6 to 6 do lprint(seq(simplify(F(n, k)), k = -6..6)) od;

%t (* Works also for n < 0 and k < 0. Uses a remark from Bill Gosper. *)

%t c := I*ArcSinh[1/2] - Pi/2;

%t F[n_, k_] := (n Sin[(k - 1) c] - I Sin[k c]) / (I^k Sqrt[5/4]);

%t Table[Simplify[F[n, k]], {n, 0, 6}, {k, 0, 6}] // TableForm

%o (Julia)

%o function fibrec(n::Int)

%o n == 0 && return (BigInt(0), BigInt(1))

%o a, b = fibrec(div(n, 2))

%o c = a * (b * 2 - a)

%o d = a * a + b * b

%o iseven(n) ? (c, d) : (d, c + d)

%o end

%o function Fibonacci(n::Int, k::Int)

%o k == 0 && return BigInt(n)

%o k == 1 && return BigInt(1)

%o k < 0 && return (-1)^(k-1)*Fibonacci(-n - 1, 2 - k)

%o a, b = fibrec(k - 1)

%o a*n + b

%o end

%o for n in -6:6

%o println([n], [Fibonacci(n, k) for k in -6:6])

%o end

%Y Cf. A000045, A000032, A104449, A094588 (main diagonal).

%Y Cf. A352744, A354265 (generalized Lucas numbers).

%K nonn,tabl

%O 0,4

%A _Peter Luschny_, May 09 2022