login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A096796
a(n) = n for n <= 2; for n > 2, a(n) = 2a(n-1) - a(n - floor( 1/2 + sqrt(2n) )).
3
0, 1, 2, 3, 5, 8, 13, 23, 41, 74, 135, 257, 491, 941, 1808, 3481, 6827, 13397, 26303, 51665, 101522, 199563, 395645, 784463, 1555529, 3084755, 6117845, 12134168, 24068773, 47937983, 95480321, 190176179, 378796829, 754508903, 1502899961
OFFSET
0,3
LINKS
MATHEMATICA
a[n_] := a[n] = If[n < 3, a[n] = n, 2a[n - 1] - a[n - Floor[1/2 + Sqrt[2n]] ]]; Table[ a[n], {n, 0, 35}] (* Robert G. Wilson v *)
PROG
(PARI) {m=35; v=vector(m+1); for(n=0, m, if(n<=2, a=n, k=n-floor(1/2+sqrt(2*n)); a=2*v[n]-v[k+1]); v[n+1]=a; print1(a, ", "))} \\ Klaus Brockhaus, Aug 20 2004
(Haskell)
a096796 n = a096796_list !! n
a096796_list = 0 : 1 : zipWith (-)
(map (* 2) $ tail a096796_list) (map a096796 $ tail a083920_list)
-- Reinhard Zumkeller, Feb 12 2012
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Aug 17 2004
EXTENSIONS
More terms from Klaus Brockhaus and Robert G. Wilson v, Aug 20 2004
STATUS
approved