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.

A280521 From the "Fibonachos" game: Number of phases of the following routine: during each phase, the player removes objects from a pile of n objects as the Fibonacci sequence until the pile contains fewer objects than the next Fibonacci number. The phases continue until the pile is empty.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 1, 2, 2, 3, 2, 1, 2, 2, 3, 2, 3, 3, 2, 1, 2, 2, 3, 2, 3, 3, 2, 3, 3, 4, 3, 2, 1, 2, 2, 3, 2, 3, 3, 2, 3, 3, 4, 3, 2, 3, 3, 4, 3, 4, 4, 3, 2, 1, 2, 2, 3, 2, 3, 3, 2, 3, 3, 4, 3, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 4, 3, 4, 4, 3, 4, 4, 5, 4, 3, 2
Offset: 1

Views

Author

Peter Kagey, Jan 04 2017

Keywords

Comments

From the Fibonachos link: "Two people are sharing a plate of nachos. They take turns dividing the nachos, each taking the n-th Fibonacci number of nachos on the n-th turn. When the number of nachos left is less than the next Fibonacci number, they start the sequence over. What number of nachos (less than 500) requires the most number of restarts? How would you generate numbers of nachos with a high number of restarts?"
Ones appear at indices in A000071.
Also the number of iterations of A066628(n + 1) required to reach 0.

Examples

			a(1) = 1 via [[1]];
a(2) = 1 via [[1, 1]];
a(3) = 2 via [[1, 1], [1]];
a(4) = 1 via [[1, 1, 2]];
a(5) = 2 via [[1, 1, 2], [1]];
a(6) = 2 via [[1, 1, 2], [1, 1]];
a(7) = 1 via [[1, 1, 2, 3]];
a(8) = 2 via [[1, 1, 2, 3], [1]];
a(9) = 2 via [[1, 1, 2, 3], [1, 1]];
a(10) = 3 via [[1, 1, 2, 3], [1, 1], [1]];
An example of counting iterations of A066628(n + 1) to reach zero:
a(10) = 3 because A066628(A066628(A066628(10 + 1) + 1) + 1) = 0. Fewer iterations fails to reach zero.
		

Crossrefs

Cf. A000045, A000071, A066628, A280523 (records).
See A280053 for other sequences based on this construction. - N. J. A. Sloane, Jan 07 2017

Programs

  • Maple
    A280521 := proc(n)
        local a,nres,i ;
        a := 0 ;
        nres := n;
        while nres > 0 do
            for i from 1 do
                if A000071(i) > nres then
                    break;
                end if;
            end do:
            nres := nres-A000071(i-1) ;
            a := a+1 ;
        end do:
        a ;
    end proc:
    seq(A280521(n),n=1..80) ; # R. J. Mathar, Mar 05 2017
  • PARI
    a(n)=my(s); while(n, my(k,t); while((t=fibonacci(k++))<=n, n-=t); s++); s \\ Charles R Greathouse IV, Jan 04 2017

A215004 a(0) = a(1) = 1; for n>1, a(n) = a(n-1) + a(n-2) + floor(n/2).

Original entry on oeis.org

1, 1, 3, 5, 10, 17, 30, 50, 84, 138, 227, 370, 603, 979, 1589, 2575, 4172, 6755, 10936, 17700, 28646, 46356, 75013, 121380, 196405, 317797, 514215, 832025, 1346254, 2178293, 3524562, 5702870, 9227448, 14930334, 24157799, 39088150, 63245967, 102334135, 165580121
Offset: 0

Views

Author

Alex Ratushnyak, Jul 31 2012

Keywords

Comments

If the first two terms are {0,1}, we get A020956 except for the first term.
If the first two terms are {1,2}, we get A281362.

Crossrefs

Cf. A020956, except for first term: same formula, seed {0,1}.

Programs

  • Magma
    [Fibonacci(n+3)-(2*n+5-(-1)^n)/4: n in [0..40]]; // _G. C. Greubel, Feb 01 2018
    
  • Mathematica
    Table[((-1)^n - 2 n + 8 Fibonacci[n] + 4 LucasL[n] - 5)/4, {n, 0, 20}] (* Vladimir Reshetnikov, May 18 2016 *)
    RecurrenceTable[{a[0]==a[1]==1,a[n]==a[n-1]+a[n-2]+Floor[n/2]},a,{n,40}] (* or *) LinearRecurrence[{2,1,-3,0,1},{1,1,3,5,10},40] (* Harvey P. Dale, Jul 11 2020 *)
  • PARI
    Vec(-(x^3-x+1)/((x-1)^2*(x+1)*(x^2+x-1)) + O(x^100)) \\ Colin Barker, Sep 16 2015
    
  • PARI
    a(n)=([0,1,0,0,0;0,0,1,0,0;0,0,0,1,0;0,0,0,0,1;1,0,-3,1,2]^n* [1;1;3;5;10])[1,1] \\ Charles R Greathouse IV, Jan 16 2017
    
  • Python
    prpr = prev = 1
    for n in range(2,100):
        print(prpr, end=', ')
        curr = prpr+prev + n//2
        prpr = prev
        prev = curr
    
  • SageMath
    [fibonacci(n+3) -(n+2+(n%2))//2 for n in range(41)] # G. C. Greubel, Apr 05 2024

Formula

From Colin Barker, Sep 16 2015: (Start)
a(n) = 2*a(n-1) + a(n-2) - 3*a(n-3) + a(n-5) for n>4.
G.f.: (1-x+x^3) / ((1-x)^2*(1+x)*(1-x-x^2)). (End)
a(n) = Fibonacci(n+3) - floor((n+3)/2). - Nathan Fox, Jan 27 2017
a(n) = (-3/4 + (-1)^n/4 + (2^(-n)*((1-t)^n*(-2+t) + (1+t)^n*(2+t)))/t + (-1-n)/2) where t=sqrt(5). - Colin Barker, Feb 09 2017
From G. C. Greubel, Apr 05 2024: (Start)
a(n) = Fibonacci(n+3) - (1/4)*(2*n + 5 - (-1)^n).
E.g.f.: 2*exp(x/2)*( cosh(sqrt(5)*x/2) + (2/sqrt(5))*sinh(sqrt(5)*x/2) ) - (1/2)*( (x+2)*cosh(x) + (x+3)*sinh(x) ). (End)

A280522 The number of restarts for the routine described by A280521.

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 0, 1, 1, 2, 1, 0, 1, 1, 2, 1, 2, 2, 1, 0, 1, 1, 2, 1, 2, 2, 1, 2, 2, 3, 2, 1, 0, 1, 1, 2, 1, 2, 2, 1, 2, 2, 3, 2, 1, 2, 2, 3, 2, 3, 3, 2, 1, 0, 1, 1, 2, 1, 2, 2, 1, 2, 2, 3, 2, 1, 2, 2, 3, 2, 3, 3, 2, 1, 2, 2, 3, 2, 3, 3, 2, 3, 3, 4, 3, 2, 1
Offset: 1

Views

Author

Peter Kagey, Jan 04 2017

Keywords

Comments

This is simply one less than the number of stages, but is seems like an equally good measure, so it gets its own entry. - N. J. A. Sloane, Jan 27 2017

Crossrefs

Formula

a(n) = A280521(n) - 1.
Showing 1-3 of 3 results.