login
Ado [Simone Caramel]'s Fibonacci function: define the Fibonacci sequence by f(0) = 1, f(1) = 1, f(n) = f(n-1)+f(n-2); then a(0) = 1, a(n) = a(n-1) + 2*(f(n)-n), n > 0.
3

%I #37 Oct 16 2023 23:40:45

%S 1,1,1,1,3,9,23,51,103,195,353,619,1061,1789,2981,4925,8087,13221,

%T 21547,35039,56891,92271,149541,242231,392233,634969,1027753,1663321,

%U 2691723,4355745,7048223,11404779,18453871,29859579,48314441,78175075,126490637,204666901,331158797

%N Ado [Simone Caramel]'s Fibonacci function: define the Fibonacci sequence by f(0) = 1, f(1) = 1, f(n) = f(n-1)+f(n-2); then a(0) = 1, a(n) = a(n-1) + 2*(f(n)-n), n > 0.

%C A Pickover sequence with properties analogous to the primes.

%D Ado [Simone Caramel], Postings in egroups and newsgroups.

%H T. D. Noe, <a href="/A064551/b064551.txt">Table of n, a(n) for n = 0..500</a>

%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (4,-5,1,2,-1).

%F From _T. D. Noe_, Oct 12 2007: (Start)

%F G.f.: (1 - 3x + 2x^2 + x^3 + x^4)/((x-1)^3 (x^2 + x - 1)).

%F a(n) = 4*a(n-1) - 5*a(n-2) + a(n-3) + 2*a(n-4) - a(n-5). (End)

%F a(n) = (1/5)*2^(-n)*(-15*2^n + (10-4*sqrt(5))*(1-sqrt(5))^n + (1+sqrt(5))^n*(10+4*sqrt(5))) - n - n^2. - _Jean-François Alcover_, May 28 2013

%F a(n) = a(n-1) - 2 * A065220(n), n > 0. - _Reinhard Zumkeller_, Sep 13 2013

%F a(n) = 2*F(n+3) - n^2 - n - 3 = 1 + 2*Sum_{k=1..n} F(k+1) - k = 1 + 2*Sum_{k=1..n} A001924(k-3), F=A000045. - _Ehren Metcalfe_, Dec 27 2018

%F E.g.f.: 4*exp(x/2)*(5*cosh(sqrt(5)*x/2) + 2*sqrt(5)*sinh(sqrt(5)*x/2))/5 - exp(x)*(3 + x*(2 + x)). - _Stefano Spezia_, Oct 16 2023

%p a := proc(n) option remember: f := n->fibonacci(n+1): if n=0 then RETURN(1) fi: a(n-1)+2*(f(n)-n): end: for n from 1 to 60 do printf(`%d,`,a(n)) od:

%t a[0] = f[0] = f[1] = 1; f[n_] := f[n] = f[n - 1] + f[n - 2]; a[n_] := a[n] = a[n - 1] + 2*(f[n] - n); Table[ a[n], {n, 0, 40} ]

%t LinearRecurrence[{4,-5,1,2,-1},{1,1,1,1,3},50] (* _Harvey P. Dale_, Sep 27 2011 *)

%o (ARIBAS): function a064551(maxarg: integer); var n,r,rm,q,qm1,qm2: integer; begin qm2 := 0; qm1 := 0; rm := 0; for n := 0 to maxarg do if n < 2 then q := 1; else q := qm1 + qm2; end; qm2 := qm1; qm1 := q; if n = 0 then r := 1; else r := rm + 2*(q - n); end; rm := r; write(r," "); end; end; a064551(35).

%o (Haskell)

%o a064551 n = a064551_list !! n

%o a064551_list = 1 : zipWith (+) a064551_list

%o (map (* 2) $ zipWith (-) (drop 2 a000045_list) [1..])

%o -- _Reinhard Zumkeller_, Sep 13 2013

%Y Cf. A064550, A064552, A065220, A000045, A001924.

%K nonn,nice,easy

%O 0,5

%A _Roger L. Bagula_, Oct 08 2001