cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A001595 a(n) = a(n-1) + a(n-2) + 1, with a(0) = a(1) = 1.

Original entry on oeis.org

1, 1, 3, 5, 9, 15, 25, 41, 67, 109, 177, 287, 465, 753, 1219, 1973, 3193, 5167, 8361, 13529, 21891, 35421, 57313, 92735, 150049, 242785, 392835, 635621, 1028457, 1664079, 2692537, 4356617, 7049155, 11405773, 18454929, 29860703, 48315633, 78176337
Offset: 0

Views

Author

Keywords

Comments

2-ranks of difference sets constructed from Segre hyperovals.
Sometimes called Leonardo numbers. - George Pollard, Jan 02 2008
a(n) is the number of nodes in the Fibonacci tree of order n. A Fibonacci tree of order n (n>=2) is a complete binary tree whose left subtree is the Fibonacci tree of order n-1 and whose right subtree is the Fibonacci tree of order n-2; each of the Fibonacci trees of order 0 and 1 is defined as a single node (see the Knuth reference, p. 417). - Emeric Deutsch, Jun 14 2010
Also odd numbers whose index is a Fibonacci number: odd(Fib(k)). - Carmine Suriano, Oct 21 2010
This is the sequence A(1,1;1,1;1) of the family of sequences [a,b:c,d:k] considered by Gary Detlefs, and treated as A(a,b;c,d;k) in the W. Lang link given below. - Wolfdieter Lang, Oct 17 2010
In general, adding a constant to each successive term of a Horadam sequence with signature (c,d) will result in a third-order recurrence with signature (c+1, d-c,-d). - Gary Detlefs, Feb 01 2023

Examples

			a(7) = odd(F(7)) = odd(8) = 15. - _Carmine Suriano_, Oct 21 2010
		

References

  • E. W. Dijkstra, 'Fibonacci numbers and Leonardo numbers', circulated privately, July 1981.
  • E. W. Dijkstra, 'Smoothsort, an alternative for sorting in situ', Science of Computer Programming, 1(3): 223-233, 1982.
  • D. E. Knuth, The Art of Computer Programming, Vol. 3, 2nd edition, Addison-Wesley, Reading, MA, 1998, p. 417.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • J. Ziegenbalg, Algorithmen, Spektrum Akademischer Verlag, 1996, p. 172.

Crossrefs

Programs

  • GAP
    List([0..40], n-> 2*Fibonacci(n+1) -1); # G. C. Greubel, Jul 10 2019
    
  • Haskell
    a001595 n = a001595_list !! n
    a001595_list =
       1 : 1 : (map (+ 1) $ zipWith (+) a001595_list $ tail a001595_list)
    -- Reinhard Zumkeller, Aug 14 2011
    
  • Magma
    [2*Fibonacci(n+1)-1: n in [0..40]]; // G. C. Greubel, Jul 10 2019
    
  • Maple
    L := 1,3: for i from 3 to 40 do l := nops([ L ]): L := L,op(l,[ L ])+op(l-1,[ L ])+1: od: [ L ];
    A001595:=(1-z+z**2)/(z-1)/(z**2+z-1); # Simon Plouffe in his 1992 dissertation
    with(combinat): seq(fibonacci(n-1)+fibonacci(n+2)-1, n=0..40); # Zerinvary Lajos, Jan 31 2008
  • Mathematica
    Join[{1, 3}, Table[a[1]=1; a[2]=3; a[i]=a[i-1]+a[i-2]+1, {i, 3, 40} ] ]
    Table[2*Fibonacci[n+1]-1, {n,0,40}] (* Vladimir Joseph Stephan Orlovsky, Oct 13 2009; modified by G. C. Greubel, Jul 10 2019 *)
    RecurrenceTable[{a[0]==a[1]==1,a[n]==a[n-1]+a[n-2]+1},a,{n,40}] (* or *) LinearRecurrence[{2,0,-1},{1,1,3},40] (* Harvey P. Dale, Aug 07 2012 *)
  • PARI
    a(n) = 2*fibonacci(n+1)-1 \\ Franklin T. Adams-Watters, Sep 30 2009
    
  • Python
    from sympy import fibonacci
    def A001595(n): return (fibonacci(n+1)<<1)-1 # Chai Wah Wu, Sep 10 2024
  • Sage
    [2*fibonacci(n+1)-1 for n in (0..40)] # G. C. Greubel, Jul 10 2019
    

Formula

a(n) = 2*Fibonacci(n+1) - 1 = A006355(n+2) - 1. - Richard L. Ollerton, Mar 22 2002
G.f.: (1-x+x^2)/(1-2x+x^3) = 2/(1-x-x^2) - 1/(1-x). [Conjectured by Simon Plouffe in his 1992 dissertation; this is readily verified.]
a(n) = (2/sqrt(5))*((1+sqrt(5))/2)^(n+1) - 2/sqrt(5)*((1-sqrt(5))/2)^(n+1) - 1.
a(n+1)/a(n) is asymptotic to Phi = (1+sqrt(5))/2. - Jonathan Vos Post, May 26 2005
For n >= 2, a(n+1) = ceiling(Phi*a(n)). - Franklin T. Adams-Watters, Sep 30 2009
a(n) = Sum_{k=0..n+1} A109754(n-k+1,k) - Sum_{k=0..n} A109754(n-k,k) = Sum_{k=0..n+1} A101220(n-k+1,0,k) - Sum_{k=0..n} A101220(n-k,0,k). - Ross La Haye, May 31 2006
a(n) = A000071(n+3) - A000045(n). - Vladimir Joseph Stephan Orlovsky, Oct 13 2009
a(n) = Fibonacci(n-1) + Fibonacci(n+2) - 1. - Zerinvary Lajos, Jan 31 2008, corrected by R. J. Mathar, Dec 17 2010
a(n) = 2*a(n-1) - a(n-3); a(0)=1, a(1)=1, a(2)=3. - Harvey P. Dale, Aug 07 2012
E.g.f.: 2*exp(x/2)*(5*cosh(sqrt(5)*x/2) + sqrt(5)*sinh(sqrt(5)*x/2))/5 - exp(x). - Stefano Spezia, Jan 23 2024

Extensions

Additional comments from Christian Krattenthaler (kratt(AT)ap.univie.ac.at)
Further edits from Franklin T. Adams-Watters, Sep 30 2009, and N. J. A. Sloane, Oct 03 2009

A057508 Self-inverse permutation of natural numbers induced by the function 'reverse' (present in programming languages like Lisp, Scheme, Prolog and Haskell) when it acts on symbolless S-expressions encoded by A014486/A063171.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 5, 7, 8, 9, 14, 11, 16, 19, 10, 15, 12, 17, 18, 13, 20, 21, 22, 23, 37, 28, 42, 51, 25, 39, 30, 44, 47, 33, 53, 56, 60, 24, 38, 29, 43, 52, 26, 40, 31, 45, 46, 32, 48, 49, 50, 27, 41, 34, 54, 55, 35, 57, 58, 59, 36, 61, 62, 63, 64, 65, 107, 79, 121, 149, 70
Offset: 0

Views

Author

Antti Karttunen Sep 03 2000

Keywords

Crossrefs

The car/cdr-flipped conjugate of A069769, i.e. A057508(n) = A057163(A069769(A057163(n))). Cf. also A057164, A057509, A057510, A033538.

Programs

  • Maple
    Similar function for Maple lists can be implemented as: reverse := proc(a) if 0 = nops(a) then (a) else [op(reverse(cdr(a))),a[1]]; fi; end;

A033539 a(0)=1, a(1)=1, a(2)=1, a(n) = 2*a(n-1) + a(n-2) + 1.

Original entry on oeis.org

1, 1, 1, 4, 10, 25, 61, 148, 358, 865, 2089, 5044, 12178, 29401, 70981, 171364, 413710, 998785, 2411281, 5821348, 14053978, 33929305, 81912589, 197754484, 477421558, 1152597601, 2782616761, 6717831124, 16218279010, 39154389145
Offset: 0

Views

Author

Keywords

Comments

a(n) or a(n+1) gives the number of times certain simple recursive procedures are called to effect a reversal of a sequence of n elements (including both the top-level call and any subsequent recursive calls). See example and program lines.

Examples

			See the Python, Erlang (myrev), PARI (rev) and Forth definitions (REV3) given at Program section.
PARI, Python and Erlang functions are called a(n+1) times for the list of length n, while Forth word REV3 is called a(n) times if there are n elements in the parameter stack.
		

Crossrefs

Programs

  • Erlang
    # definition, demonstrating the reversal of the lists:
    myrev([]) -> [];
    myrev([A]) -> [A];
    myrev([X|Y]) ->
       [A|B] = myrev(Y),
       [A|myrev([X|myrev(B)])].
    
  • Forth
    # definition, demonstrating how to turn a parameter stack upside down:
    : REV3 DEPTH 0= IF ELSE DEPTH 1 = IF ELSE DEPTH 2 = IF SWAP ELSE >R RECURSE R> SWAP >R >R RECURSE R> RECURSE R> THEN THEN THEN ;
    -- Antti Karttunen, Mar 04 2013
    
  • GAP
    Concatenation([1], List([1..30], n-> (3*Lucas(2,-1,n-1)[2] -2)/4 )); # G. C. Greubel, Oct 13 2019
    
  • Haskell
    a033539 n = a033539_list !! n
    a033539_list =
       1 : 1 : 1 : (map (+ 1) $ zipWith (+) (tail a033539_list)
                                            (map (2 *) $ drop 2 a033539_list))
    -- Reinhard Zumkeller, Aug 14 2011
    
  • Magma
    I:=[1,1,4]; [1] cat [n le 3 select I[n] else 3*Self(n-1) - Self(n-2) - Self(n-3): n in [1..30]]; // G. C. Greubel, Oct 13 2019
    
  • Maple
    seq(coeff(series((1 -2*x -x^2 +3*x^3)/((1-x)*(1-2*x-x^2)), x, n+1), x, n), n = 0..30); # G. C. Greubel, Oct 13 2019
  • Mathematica
    Join[{1},RecurrenceTable[{a[0]==a[1]==1,a[n]==2a[n-1]+a[n-2]+1},a,{n,30}]] (* or *) LinearRecurrence[{3,-1,-1},{1,1,1,4},30] (* Harvey P. Dale, Nov 20 2011 *)
    Table[If[n==0, 1, (3*LucasL[n-1, 2] -2)/4], {n, 0, 30}] (* G. C. Greubel, Oct 13 2019 *)
  • PARI
    /* needs version >= 2.5 */
    /* function demonstrating the reversal of the lists and counting the function calls: */
    rev( L )={ cnt++; if( #L>1, my(x,y); x=L[#L]; listpop(L); L=rev(L); y=L[#L]; listpop(L); L=rev(L); listput(L,x); L=rev(L); listput(L,y)); L }
    for(n=0,50,cnt=0;print(n": rev(",L=List(vector(n,i,i)),")=",rev(L),",  cnt="cnt)) \\ Antti Karttunen, Mar 05 2013, partially based on previous PARI code from Michael Somos, 1999. Edited by M. F. Hasler, Mar 05 2013
    
  • PARI
    concat([1], vector(30, n, (3*sum(k=0,(n-1)\2, binomial(n-1,2*k) * 2^k) - 1)/2 )) \\ G. C. Greubel, Oct 13 2019
    
  • Prolog
    rev([],[]).
       rev([A],[A]).
       rev([A|XB],[B|YA]) :-
    rev(XB,[B|Y]), rev(Y,X), rev([A|X],YA). % Lewis Baxter, Jan 04 2021
  • Python
    # function, demonstrating the reversal of the lists:
    def myrev(lista):
      '''Reverses a list, in cumbersome way.'''
      if(len(lista) < 2): return(lista)
      else:
        tr = myrev(lista[1:])
        return([tr[0]]+myrev([lista[0]]+myrev(tr[1:])))
    
  • Sage
    [1]+[(3*lucas_number2(n-1,2,-1) -2)/4 for n in (1..30)] # G. C. Greubel, Oct 13 2019
    

Formula

a(n) = (3/4)*(1+sqrt(2))^(n-1) + 3/4*(1-sqrt(2))^(n-1) - 1/2 + 3*0^n, with n >= 0. - Jaume Oliver Lafont, Sep 10 2009
G.f.: (1 - 2*x - x^2 + 3*x^3)/((1-x)*(1-2*x-x^2)). - Jaume Oliver Lafont, Sep 09 2009
a(n) = 3*a(n-1) - a(n-2) - a(n-3), a(0)=1, a(1)=1, a(2)=1, a(3)=4. - Harvey P. Dale, Nov 20 2011
a(n) = (3*A001333(n-1) - 1)/2. - R. J. Mathar, Mar 04 2013
a(n) = -1/2 - (3/4)*(1+sqrt(2))^n - (3/4)*sqrt(2)*(1-sqrt(2))^n - (3/4)*(1-sqrt(2))^n + (3/4)*(1+sqrt(2))^n*sqrt(2) for n >= 1. - Alexander R. Povolotsky, Mar 05 2013
E.g.f.: 3 + (1/2)*exp(x)*(-1 - 3*cosh(sqrt(2)*x) + 3*sqrt(2)*sinh(sqrt(2)*x)). - Stefano Spezia, Oct 13 2019
Showing 1-3 of 3 results.