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-10 of 20 results. Next

A192744 Constant term of the reduction by x^2->x+1 of the polynomial p(n,x) defined below in Comments.

Original entry on oeis.org

1, 1, 3, 8, 29, 133, 762, 5215, 41257, 369032, 3676209, 40333241, 483094250, 6271446691, 87705811341, 1314473334832, 21017294666173, 357096406209005, 6424799978507178, 122024623087820183, 2439706330834135361, 51219771117454755544
Offset: 0

Views

Author

Clark Kimberling, Jul 09 2011

Keywords

Comments

The titular polynomial is defined recursively by p(n,x)=x*p(n-1,x)+n! for n>0, where p(0,x)=1; see the Example. For an introduction to polynomial reduction, see A192232. The discussion at A192232 Comments continues here:
...
Let R(p,q,s) denote the "reduction of polynomial p by q->s" as defined at A192232. Suppose that q(x)=x^k for some k>0 and that s(x)=s(k,0)*x^(k-1)+s(k,1)*x^(k-2)+...+s(k,k-2)x+s(k,k-1).
...
First, we shall take p(x)=x^n, where n>=0; the results will be used to formulate R(p,q,s) for general p. Represent R(x^n,q,s) by
...
R(x^n)=s(n,0)*x^(k-1)+s(n,1)*x^(k-2)+...+s(n,k-2)*x+s(n,k-1).
...
Then each of the sequences u(n)=s(n,h), for h=0,1,...,k-1, satisfies this linear recurrence relation:
...
u(n)=s(k,0)*u(n-1)+s(k,1)*u(n-2)+...+s(k,k-2)*u(n-k-1)+s(k,k-1)*u(n-k), with initial values tabulated here:
...
n: ..s(n,0)...s(n,1)..s(n,2).......s(n,k-2)..s(n,k-1)
0: ....0........0.......0..............0.......1
1: ....0........0.......0..............1.......0
...
k-2: ..0........1.......0..............0.......0
k-1: ..0........0.......0..............0.......0
k: ..s(k,0)...s(k,1)..s(k,2).......s(k,k-2)..s(k,k-1)
...
That completes the formulation for p(x)=x^n. Turning to the general case, suppose that
...
p(n,x)=p(n,0)*x^n+p(n,1)*x^(n-1)+...+p(n,n-1)*x+p(n,n)
...
is a polynomial of degree n>=0. Then the reduction denoted by (R(p(n,x) by x^k -> s(x)) is the polynomial of degree k-1 given by the matrix product P*S*X, where P=(p(n,0)...p(n,1).........p(n-k)...p(n,n-k+1); X has all 0's except for main diagonal (x^(k-1), x^(k-2)...x,1); and S has
...
row 1: ... s(n,0) ... s(n,1) ...... s(n,k-2) . s(n,k-1)
row 2: ... s(n-1,0) . s(n-1,1) .... s(n-1,k-2) s(n-1,k-1)
...
row n-k+1: s(k,0).... s(k,1) ...... s(k,k-2) ..s(k,k-1)
row n-k+2: p(n,n-k+1) p(n,n-k+2) .. p(n,n-1) ..p(n,n)
*****
As a class of examples, suppose that (v(n)), for n>=0, is a sequence, that p(0,x)=1, and p(n,x)=v(n)+p(n-1,x) for n>0. If q(x)=x^2 and s(x)=x+1, and we write the reduction R(p(n,x)) as u1(n)*x+u2(n), then the sequences u1 and u2 are convolutions with the Fibonacci sequence, viz., let F=(0,1,1,2,3,5,8,...)=A000045 and let G=(1,0,1,1,2,3,5,8...); then u1=G**v and u2=F**v, where ** denotes convolution. Examples (with a few exceptions for initial terms):
...
If v(n)=n! then u1=A192744, u2=A192745.
If v(n)=n+1 then u1=A000071, u2=A001924.
If v(n)=2n then u1=A014739, u2=A027181.
If v(n)=2n+1 then u1=A001911, u2=A001891.
If v(n)=3n+1 then u1=A027961, u2=A023537.
If v(n)=3n+2 then u1=A192746, u2=A192747.
If v(n)=3n then u1=A154691, u2=A192748.
If v(n)=4n+1 then u1=A053311, u2=A192749.
If v(n)=4n+2 then u1=A192750, u2=A192751.
If v(n)=4n+3 then u1=A192752, u2=A192753.
If v(n)=4n then u1=A147728, u2=A023654.
If v(n)=5n+1 then u1=A192754, u2=A192755.
If v(n)=5n then u1=A166863, u2=A192756.
If v(n)=floor((n+1)tau) then u1=A192457, u2=A023611.
If v(n)=floor((n+2)/2) then u1=A052952, u2=A129696.
If v(n)=floor((n+3)/3) then u1=A004695, u2=A178982.
If v(n)=floor((n+4)/4) then u1=A080239, u2=A192758.
If v(n)=floor((n+5)/5) then u1=A124502, u2=A192759.
If v(n)=n+2 then u1=A001594, u2=A192760.
If v(n)=n+3 then u1=A022318, u2=A192761.
If v(n)=n+4 then u1=A022319, u2=A192762.
If v(n)=2^n then u1=A027934, u2=A008766.
If v(n)=3^n then u1=A106517, u2=A094688.

Examples

			The first five polynomials and their reductions:
1 -> 1
1+x -> 1+x
2+x+x^2 -> 3+2x
6+2x+x^2+x^3 -> 8+5x
24+6x+2x^2+x^3+x^4 -> 29+13x, so that
A192744=(1,1,3,8,29,...) and A192745=(0,1,2,5,13,...).
		

Crossrefs

Cf. A192232.

Programs

  • Maple
    A192744p := proc(n,x)
        option remember;
        if n = 0 then
            1;
        else
            x*procname(n-1,x)+n! ;
            expand(%) ;
        end if;
    end proc:
    A192744 := proc(n)
        local p;
        p := A192744p(n,x) ;
        while degree(p,x) > 1 do
            p := algsubs(x^2=x+1,p) ;
            p := expand(p) ;
        end do:
        coeftayl(p,x=0,0) ;
    end proc: # R. J. Mathar, Dec 16 2015
  • Mathematica
    q = x^2; s = x + 1; z = 40;
    p[0, n_] := 1; p[n_, x_] := x*p[n - 1, x] + n!;
    Table[Expand[p[n, x]], {n, 0, 7}]
    reduce[{p1_, q_, s_, x_}] :=
    FixedPoint[(s PolynomialQuotient @@ #1 +
           PolynomialRemainder @@ #1 &)[{#1, q, x}] &, p1]
    t = Table[reduce[{p[n, x], q, s, x}], {n, 0, z}];
    u1 = Table[Coefficient[Part[t, n], x, 0], {n, 1, z}]
      (* A192744 *)
    u2 = Table[Coefficient[Part[t, n], x, 1], {n, 1, z}]
      (* A192745 *)

Formula

G.f.: (1-x)/(1-x-x^2)/Q(0), where Q(k)= 1 - x*(k+1)/(1 - x*(k+1)/Q(k+1)); (continued fraction). - Sergei N. Gladkovskii, May 20 2013
Conjecture: a(n) +(-n-2)*a(n-1) +2*(n-1)*a(n-2) +3*a(n-3) +(-n+2)*a(n-4)=0. - R. J. Mathar, May 04 2014
Conjecture: (-n+2)*a(n) +(n^2-n-1)*a(n-1) +(-n^2+3*n-3)*a(n-2) -(n-1)^2*a(n-3)
=0. - R. J. Mathar, Dec 16 2015

A104763 Triangle read by rows: Fibonacci(1), Fibonacci(2), ..., Fibonacci(n) in row n.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 3, 5, 1, 1, 2, 3, 5, 8, 1, 1, 2, 3, 5, 8, 13, 1, 1, 2, 3, 5, 8, 13, 21, 1, 1, 2, 3, 5, 8, 13, 21, 34, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233
Offset: 1

Views

Author

Gary W. Adamson, Mar 23 2005

Keywords

Comments

Triangle of A104762, Fibonacci sequence in each row starts from the right.
The triangle or chess sums, see A180662 for their definitions, link the Fibonacci(n) triangle to sixteen different sequences, see the crossrefs. The knight sums Kn14 - Kn18 have been added. As could be expected all sums are related to the Fibonacci numbers. - Johannes W. Meijer, Sep 22 2010
Sequence B is called a reluctant sequence of sequence A, if B is triangle array read by rows: row number k coincides with first k elements of the sequence A. Sequence A104763 is reluctant sequence of Fibonacci numbers (A000045), except 0. - Boris Putievskiy, Dec 13 2012

Examples

			First few rows of the triangle are:
  1;
  1, 1;
  1, 1, 2;
  1, 1, 2, 3;
  1, 1, 2, 3, 5;
  1, 1, 2, 3, 5, 8;
  1, 1, 2, 3, 5, 8, 13; ...
		

Crossrefs

Cf. A000071 (row sums). - R. J. Mathar, Jul 22 2009
Triangle sums (see the comments): A000071 (Row1; Kn4 & Ca1 & Ca4 & Gi1 & Gi4); A008346 (Row2); A131524 (Kn11); A001911 (Kn12); A006327 (Kn13); A167616 (Kn14); A180671 (Kn15); A180672 (Kn16); A180673 (Kn17); A180674 (Kn18); A052952 (Kn21 & Kn22 & Kn23 & Fi2 & Ze2); A001906 (Kn3 &Fi1 & Ze3); A004695 (Ca2 & Ze4); A001076 (Ca3 & Ze1); A080239 (Gi2); A081016 (Gi3). - Johannes W. Meijer, Sep 22 2010

Programs

  • GAP
    Flat(List([1..15], n -> List([1..n], k -> Fibonacci(k)))); # G. C. Greubel, Jul 13 2019
  • Haskell
    a104763 n k = a104763_tabl !! (n-1) !! (k-1)
    a104763_row n = a104763_tabl !! (n-1)
    a104763_tabl = map (flip take $ tail a000045_list) [1..]
    -- Reinhard Zumkeller, Aug 15 2013
    
  • Magma
    [Fibonacci(k): k in [1..n], n in [1..15]]; // G. C. Greubel, Jul 13 2019
    
  • Mathematica
    Table[Fibonacci[k], {n,15}, {k,n}]//Flatten (* G. C. Greubel, Jul 13 2019 *)
  • PARI
    for(n=1,15, for(k=1,n, print1(fibonacci(k), ", "))) \\ G. C. Greubel, Jul 13 2019
    
  • Sage
    [[fibonacci(k) for k in (1..n)] for n in (1..15)] # G. C. Greubel, Jul 13 2019
    

Formula

F(1) through F(n) starting from the left in n-th row.
T(n,k) = A000045(k), 1<=k<=n. - R. J. Mathar, May 02 2008
a(n) = A000045(m), where m= n-t(t+1)/2, t=floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Dec 13 2012
G.f.: (x*y)/((x-1)*(x^2*y^2+x*y-1)). - Vladimir Kruchinin, Jun 21 2025

Extensions

Edited by R. J. Mathar, May 02 2008
Extended by R. J. Mathar, Aug 27 2008

A080239 Antidiagonal sums of triangle A035317.

Original entry on oeis.org

1, 1, 2, 3, 6, 9, 15, 24, 40, 64, 104, 168, 273, 441, 714, 1155, 1870, 3025, 4895, 7920, 12816, 20736, 33552, 54288, 87841, 142129, 229970, 372099, 602070, 974169, 1576239, 2550408, 4126648, 6677056, 10803704, 17480760, 28284465, 45765225, 74049690
Offset: 1

Views

Author

Paul Barry, Feb 11 2003

Keywords

Comments

Convolution of Fibonacci sequence with sequence (1, 0, 0, 0, 1, 0, 0, 0, 1, ...).
There is an interesting relation between a(n) and the Fibonacci sequence f(n). Sqrt(a(4n-2)) = f(2n). By using this fact we can calculate the value of a(n) by the following (1),(2),(3),(4) and (5). (1) a(1) = 1. (2) If n = 2 (mod 4), then a(n) = f((n+2)/2)^2. (3) If n = 3 (mod 4), then a(n) = (f((n+5)/2)^2-2f((n+1)/2)^2-1)/3. (4) If n = 0 (mod 4), then a(n) = (f((n+4)/2)^2+f(n/2)^2-1)/3. (5) If n = 1 (mod 4), then a(n) = (2f((n+3)/2)^2-f((n-1)/2)^2+1)/3. - Hiroshi Matsui and Ryohei Miyadera, Aug 08 2006
Sequences of the form s(0)=a, s(1)=b, s(n) = s(n-1) + s(n-2) + k if n mod m = p, else s(n) = s(n-1) + s(n-2) will have a form fib(n-1)*a + fib(n)*b + P(x)*k. a(n) is the P(x) sequence for m=4...s(n) = fib(n)*a + fib(n-1)*b + a(n-4-p)*k. - Gary Detlefs, Dec 05 2010
A different formula for a(n) as a function of the Fibonacci numbers f(n) may be conjectured. The pattern is of the form a(n) = f(p)*f(p-q) - 1 if n mod 4 = 3, else f(p)*f(p-q) where p = 2,2,4,4,4,4,6,6,6,6,8,8,8,8... and q = 0,1,3,2,0,1,3,2,0,1,3,2... p(n) = 2 * A002265(n+4) = 2*(floor((n+3)/2) - floor((n+3)/4)) (see comment by Jonathan Vos Post at A002265). A general formula for sequences having period 4 with terms a,b,c,d is given in A121262 (the discrete Fourier transform, as for all periodic sequences) and is a function of t(n)= 1/4*(2*cos(n*Pi/2) + 1 + (-1)^n). r4(a,b,c,d,n) = a*t(n+3) + b*t(n+2) + c*t(n+1) + d*t(n). This same formula may be used to subtract the 1 at n mod 4 = 3. a(n) = f(p(n))*f(p(n) - r4(1,0,3,2,n)) - r4(0,0,1,0,n). - Gary Detlefs, Dec 09 2010
This sequence is the sequence B4,1 on p. 34 of "Pascal-like triangles and Fibonacci-like sequences" in the references. In this article the authors treat more general sequences that have this sequence as an example. - Hiroshi Matsui and Ryohei Miyadera, Apr 11 2014
It is easy to see that a(n) = a(n-4) + f(n), where f(n) is the Fibonacci sequence. By using this repeatedly we have for a natural number m
a(4m) =a(4) + f(4m) + f(4m-4) + ... + f(8),
a(4m+1) = a(1) + f(4m) + f(4m-4) + ... + f(5),
a(4m+2) = a(2) + f(4m) + f(4m-4) + ... + f(6) and
a(4m+3) = a(3) + f(4m) + f(4m-4) + ... + f(7).
- Wataru Takeshita and Ryohei Miyadera, Apr 11 2014
a(n-1) counts partially ordered partitions of (n-1) into (1,2,3,4) where the position (order) of 2's is unimportant. E.g., a(5)=6 (n-1)=4 These are (4),(31),(13),(22),(211,121,112=one),(1111). - David Neil McGrath, May 12 2015

Crossrefs

Programs

  • GAP
    List([1..40], n-> Sum([0..Int((n-1)/4)], k-> Fibonacci(n-4*k) )); # G. C. Greubel, Jul 13 2019
  • Haskell
    a080239 n = a080239_list !! (n-1)
    a080239_list = 1 : 1 : zipWith (+)
       (tail a011765_list) (zipWith (+) a080239_list $ tail a080239_list)
    -- Reinhard Zumkeller, Jan 06 2012
    
  • Magma
    I:=[1,1,2,3,6,9]; [n le 6 select I[n] else Self(n-1)+Self(n-2)+Self(n-4)-Self(n-5)-Self(n-6): n in [1..50]]; // Vincenzo Librandi, Jun 07 2015
    
  • Maple
    f:=proc(n) option remember; local t1; if n <= 2 then RETURN(1); fi: if n mod 4 = 1 then t1:=1 else t1:=0; fi: f(n-1)+f(n-2)+t1; end; [seq(f(n), n=1..100)]; # N. J. A. Sloane, May 25 2008
    with(combinat): f:=n-> fibonacci(n): p:=n-> 2*(floor((n+3)/2)-floor((n+3)/4)): t:=n-> 1/4*(2*cos(n*Pi/2)+1+(-1)^n): r4:=(a,b,c,d,n)-> a*t(n+3)+b*t(n+2)+c*t(n+1)+d*t(n): seq(f(p(n))*f(p(n)-r4(1,0,3,2,n))-r4(0,0,1,0,n), n = 1..33); # Gary Detlefs, Dec 09 2010
    with(combinat): a:=proc(n); add(fibonacci(n-4*k),k=0..floor((n-1)/4)) end: seq(a(n), n = 1..33); # Johannes W. Meijer, Apr 19 2012
  • Mathematica
    (*f[n] is the Fibonacci sequence and a[n] is the sequence of A080239*) f[n_]:= f[n] =f[n-1] +f[n-2]; f[1]=1; f[2]=1; a[n_]:= Which[n==1, 1, Mod[n, 4]==2, f[(n+2)/2]^2, Mod[n, 4]==3, (f[(n+5)/2]^2 - 2f[(n + 1)/2]^2 -1)/3, Mod[n, 4]==0, (f[(n+4)/2]^2 + f[n/2]^2 -1)/3, Mod[n, 4] == 1, (2f[(n+3)/2]^2 -f[(n-1)/2]^2 +1)/3] (* Hiroshi Matsui and Ryohei Miyadera, Aug 08 2006 *)
    a=0; b=0; lst={a,b}; Do[z=a+b+1; AppendTo[lst,z]; a=b; b=z; z=a+b; AppendTo[lst,z]; a=b; b=z; z=a+b; AppendTo[lst,z]; a=b; b=z; z=a+b; AppendTo[lst,z]; a=b; b=z,{n,4!}]; lst (* Vladimir Joseph Stephan Orlovsky, Feb 16 2010 *)
    (* Let f[n] be the Fibonacci sequence and a2[n] the sequence A080239 expressed by another formula discovered by Wataru Takeshita and Ryohei Miyadera *)
    f=Fibonacci; a2[n_]:= Block[{m, s}, s = Mod[n, 4]; m = (n-s)/4;
    Which[n==1, 1, n==2, 1, n==3, 2, s==0, 3 + Sum[f[4 i], {i, 2, m}], s == 1, 1 + Sum[f[4i+1], {i, 1, m}], s==2, 1 + Sum[f[4i+2], {i, 1, m}], s == 3, 2 + Sum[f[4i+3], {i, 1, m}]]]; Table[a2[n], {n, 1, 40}] (* Ryohei Miyadera, Apr 11 2014, minor update by Jean-François Alcover, Apr 29 2014 *)
    LinearRecurrence[{1, 1, 0, 1, -1, -1}, {1, 1, 2, 3, 6, 9}, 41] (* Vincenzo Librandi, Jun 07 2015 *)
  • PARI
    vector(40, n, f=fibonacci; sum(k=0,((n-1)\4), f(n-4*k))) \\ G. C. Greubel, Jul 13 2019
    
  • Sage
    [sum(fibonacci(n-4*k) for k in (0..floor((n-1)/4))) for n in (1..40)] # G. C. Greubel, Jul 13 2019
    

Formula

G.f.: x/((1-x^4)(1 - x - x^2)) = x/(1 - x - x^2 - x^4 + x^5 + x^6).
a(n) = a(n-1) + a(n-2) + a(n-4) - a(n-5) - a(n-6).
a(n) = Sum_{j=0..floor(n/2)} Sum_{k=0..floor((n-j)/2)} binomial(n-j-2k, j-2k) for n>=0.
Another recurrence is given in the Maple code.
If n mod 4 = 1 then a(n) = a(n-1) + a(n-2) + 1, else a(n)= a(n-1) + a(n-2). - Gary Detlefs, Dec 05 2010
a(4n) = A058038(n) = Fibonacci(2n+2)*Fibonacci(2n).
a(4n+1) = A081016(n) = Fibonacci(2n+2)*Fibonacci(2n+1).
a(4n+2) = A049682(n+1) = Fibonacci(2n+2)^2.
a(4n+3) = A081018(n+1) = Fibonacci(2n+2)*Fibonacci(2n+3).
a(n) = 8*a(n-4) - 8*a(n-8) + a(n-12), n>12. - Gary Detlefs, Dec 10 2010
a(n+1) = a(n) + a(n-1) + A011765(n+1). - Reinhard Zumkeller, Jan 06 2012
a(n) = Sum_{k=0..floor((n-1)/4)} Fibonacci(n-4*k). - Johannes W. Meijer, Apr 19 2012

A173284 Triangle by columns, Fibonacci numbers in every column shifted down twice, for k > 0.

Original entry on oeis.org

1, 1, 2, 1, 3, 1, 5, 2, 1, 8, 3, 1, 13, 5, 2, 21, 8, 3, 1, 34, 13, 5, 2, 1, 55, 21, 8, 3, 1, 89, 34, 13, 5, 2, 1, 144, 55, 21, 8, 3, 1, 233, 89, 34, 13, 5, 2, 1, 377, 144, 55, 21, 8, 3, 1, 610, 233, 89, 34, 13, 5, 2, 1
Offset: 0

Views

Author

Gary W. Adamson, Feb 14 2010

Keywords

Comments

The row sums equal A052952.
Let the triangle = M. Then lim_{n->infinity} M^n = A173285 as a left-shifted vector.
A173284 * [1, 2, 3, ...] = A054451: (1, 1, 4, 5, 12, 17, 33, ...). - Gary W. Adamson, Mar 03 2010
From Johannes W. Meijer, Sep 05 2013: (Start)
Triangle read by rows formed from antidiagonals of triangle A104762.
The diagonal sums lead to A004695. (End)

Examples

			First few rows of the triangle:
    1;
    1;
    2,   1;
    3,   1;
    5,   2,  1;
    8,   3,  1;
   13,   5,  2,  1;
   21,   8,  3,  1;
   34,  13,  5,  2,  1;
   55,  21,  8,  3,  1;
   89,  34, 13,  5,  2, 1;
  144,  55, 21,  8,  3, 1;
  233,  89, 34, 13,  5, 2, 1;
  377, 144, 55, 21,  8, 3, 1;
  610, 233, 89, 34, 13, 5, 2, 1;
  ...
		

Crossrefs

Cf. (Similar triangles) A008315 (Catalan), A011973 (Pascal), A102541 (Losanitsch), A122196 (Fractal), A122197 (Fractal), A128099 (Pell-Jacobsthal), A152198, A152204, A207538, A209634.

Programs

  • Maple
    T := proc(n, k): if n<0 then return(0) elif k < 0 or k > floor(n/2) then return(0) else combinat[fibonacci](n-2*k+1) fi: end: seq(seq(T(n, k), k=0..floor(n/2)), n=0..14); # Johannes W. Meijer, Sep 05 2013

Formula

Triangle by columns, Fibonacci numbers in every column shifted down twice, for k > 0.
From Johannes W. Meijer, Sep 05 2013: (Start)
T(n,k) = A000045(n-2*k+1), n >= 0 and 0 <= k <= floor(n/2).
T(n,k) = A104762(n-k, k). (End)

Extensions

Term a(15) corrected by Johannes W. Meijer, Sep 05 2013

A124502 a(1)=a(2)=1; thereafter, a(n+1) = a(n) + a(n-1) + 1 if n is a multiple of 5, otherwise a(n+1) = a(n) + a(n-1).

Original entry on oeis.org

1, 1, 2, 3, 5, 9, 14, 23, 37, 60, 98, 158, 256, 414, 670, 1085, 1755, 2840, 4595, 7435, 12031, 19466, 31497, 50963, 82460, 133424, 215884, 349308, 565192, 914500, 1479693, 2394193, 3873886, 6268079, 10141965, 16410045, 26552010, 42962055, 69514065, 112476120
Offset: 1

Views

Author

N. J. A. Sloane, May 25 2008

Keywords

Comments

If we split this sequence into 5 separate sequences of n mod 5, each individual sequence is of the form a(n) = 12*a(n-1) - 10*a(n-2) - a(n-3). For example, 12*98 - 10*9 - 1 = 1085. This is the same recurrence exhibited in A138134 and the n mod 5 =0 sequence...5, 60, 670, 7435 is A138134.

Examples

			a(6) = a(5) + a(4) + 1 = 5 + 3 + 1 = 9 because n=5 is a multiple of 5.
a(7) = a(6) + a(5) = 9 + 5 = 14 because n=6 is not a multiple of 5.
		

Crossrefs

Programs

  • Maple
    A124502:=proc(n) option remember; local t1; if n <= 2 then return 1; fi: if n mod 5 = 1 then t1:=1 else t1:=0; fi: procname(n-1)+procname(n-2)+t1; end proc; [seq(A124502(n), n=1..100)]; # N. J. A. Sloane, May 25 2008
  • Mathematica
    a=0; b=0; lst={a,b}; Do[z=a+b+1; AppendTo[lst,z]; a=b; b=z; z=a+b; AppendTo[lst,z]; a=b; b=z; z=a+b; AppendTo[lst,z]; a=b; b=z; z=a+b; AppendTo[lst,z]; a=b; b=z; z=a+b; AppendTo[lst,z]; a=b; b=z,{n,4!}]; lst (* Vladimir Joseph Stephan Orlovsky, Feb 16 2010 *)
    nxt[{n_,a_,b_}]:={n+1,b,If[Divisible[n,5],a+b+1,a+b]}; NestList[nxt,{2,1,1},40][[All,2]] (* or *) LinearRecurrence[{1,1,0,0,1,-1,-1},{1,1,2,3,5,9,14},40] (* Harvey P. Dale, Jun 15 2017 *)

Formula

O.g.f.: x/((1-x)*(x^4 + x^3 + x^2 + x + 1)*(1 - x - x^2)). - R. J. Mathar, May 30 2008
a(n+5) = a(n) + Fibonacci(n+5), n>5.
a(n) = 12*a(n-5) - 10*a(n-10) - a(n-15). - Gary Detlefs, Dec 10 2010

Extensions

Typo in Maple code corrected by R. J. Mathar, May 30 2008
More specific name from R. J. Mathar, Dec 09 2009
Indices in definition corrected by N. J. A. Sloane, Nov 25 2010

A296239 a(n) = distance from n to nearest Fibonacci number.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 2, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 16, 15, 14, 13, 12, 11, 10, 9
Offset: 0

Views

Author

Rémy Sigrist, Dec 09 2017

Keywords

Comments

The Fibonacci numbers correspond to sequence A000045.
This sequence is analogous to:
- A051699 (distance to nearest prime),
- A053188 (distance to nearest square),
- A053646 (distance to nearest power of 2),
- A053615 (distance to nearest oblong number),
- A053616 (distance to nearest triangular number),
- A061670 (distance to nearest power),
- A074989 (distance to nearest cube),
- A081134 (distance to nearest power of 3),
The local maxima of the sequence correspond to positive terms of A004695.
a(n) = 0 iff n = A000045(k) for some k >= 0.
a(n) = 1 iff n = A061489(k) for some k > 4.
For any n >= 0, abs(a(n+1) - a(n)) <= 1.
For any n > 0, a(n) < n, and a^k(n) = 0 for some k > 0 (where a^k denotes the k-th iterate of a); k equals A105446(n) for n = 1..80 (and possibly more values).
a(n) > max(a(n-1), a(n+1)) iff n = A001076(k) for some k > 1.

Examples

			For n = 42:
- A000045(9) = 34 <= 42 <= 55 = A000045(10),
- a(42) = min(42 - 34, 55 - 42) = min(8, 13) = 8.
		

Crossrefs

Programs

  • Mathematica
    fibPi[n_] := 1 + Floor[ Log[ GoldenRatio, 1 + n*Sqrt@5]]; f[n_] := Block[{m = fibPi@ n}, Min[n - Fibonacci[m -1], Fibonacci[m] - n]]; Array[f, 81, 0] (* Robert G. Wilson v, Dec 11 2017 *)
    With[{nn=80,fibs=Fibonacci[Range[0,20]]},Table[Abs[n-Nearest[fibs,n]][[1]],{n,0,nn}]] (* Harvey P. Dale, Jul 02 2022 *)
  • PARI
    a(n) = for (i=1, oo, if (n<=fibonacci(i), return (min(n-fibonacci(i-1), fibonacci(i)-n))))

Formula

a(n) = abs(n - Fibonacci(floor(log(sqrt(20)*n)/log((1 + sqrt(5))/2)-1))). - Jon E. Schoenfield, Dec 14 2017

A027976 n-th diagonal sum of right justified array T given by A027960.

Original entry on oeis.org

1, 1, 4, 6, 10, 18, 29, 47, 78, 126, 204, 332, 537, 869, 1408, 2278, 3686, 5966, 9653, 15619, 25274, 40894, 66168, 107064, 173233, 280297, 453532, 733830, 1187362, 1921194, 3108557, 5029751, 8138310, 13168062, 21306372, 34474436, 55780809, 90255245, 146036056, 236291302, 382327358
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • GAP
    a:=[1,1,4,6,10];; for n in [6..40] do a[n]:=a[n-1]+a[n-2]+a[n-3]-a[n-4]-a[n-5]; od; a; # G. C. Greubel, Sep 26 2019
  • Magma
    R:=PowerSeriesRing(Integers(), 40); Coefficients(R!( (1 + 2*x^2)/((1-x^3)*(1-x-x^2)) )); // G. C. Greubel, Sep 26 2019
    
  • Maple
    seq(coeff(series((1 + 2*x^2)/((1-x^3)*(1-x-x^2)), x, n+1), x, n), n = 0..40); # G. C. Greubel, Sep 26 2019
  • Mathematica
    LinearRecurrence[{1,1,1,-1,-1}, {1,1,4,6,10}, 41] (* or *) Table[ (Fibonacci[n+1] +LucasL[n+2] -2*Sin[2*Pi*n/3]/Sqrt[3] -2)/2, {n,0,40}] (* G. C. Greubel, Sep 26 2019 *)
  • PARI
    my(x='x+O('x^40)); Vec((1 + 2*x^2)/((1-x^3)*(1-x-x^2))) \\ G. C. Greubel, Sep 26 2019
    
  • Sage
    def A027976_list(prec):
        P. = PowerSeriesRing(ZZ, prec)
        return P((1 + 2*x^2)/((1-x^3)*(1-x-x^2))).list()
    A027976_list(40) # G. C. Greubel, Sep 26 2019
    

Formula

G.f.: (1 + 2*x^2)/((1-x^3)*(1-x-x^2)).
From G. C. Greubel, Sep 26 2019: (Start)
a(n) = (Fibonacci(n) + 4*Fibonacci(n+1) - A102283(n) - 2)/2.
a(n) = (Fibonacci(n+1) + Lucas(n+2) - 2*sin(2*Pi*n/3)/sqrt(3) - 2)/2. (End)

Extensions

Terms a(28) onward added by G. C. Greubel, Sep 26 2019

A131132 a(n) = a(n-1) + a(n-2) + 1 if n is a multiple of 6, otherwise a(n) = a(n-1) + a(n-2).

Original entry on oeis.org

1, 1, 2, 3, 5, 8, 14, 22, 36, 58, 94, 152, 247, 399, 646, 1045, 1691, 2736, 4428, 7164, 11592, 18756, 30348, 49104, 79453, 128557, 208010, 336567, 544577, 881144, 1425722, 2306866, 3732588, 6039454, 9772042, 15811496, 25583539, 41395035, 66978574, 108373609
Offset: 0

Views

Author

N. J. A. Sloane, May 25 2008

Keywords

Comments

Also: convolution of A000045 with the period-6 sequence (0,0,0,0,0,0, 1,...). - R. J. Mathar, May 30 2008
Sequences of the form s(0)=a, s(1)= b, s(n) = s(n-1) + s(n-2) + k if n mod m = p, else s(n) = s(n-1) + s(n-2) have a form s(n) = fibonacci(n-1)*a + fibonacci(n)*b + P(x)*k. a(n) is the P(x) sequence for m=6. s(n) = fib(n)*a + fib(n-1)*b + a(n-6-p)*k. - Gary Detlefs, Dec 05 2010
a(n) is the number of compositions of n where the order of the 2 and the 3 does not matter. - Gregory L. Simay, May 18 2017

Examples

			Since 5 is not a multiple of 6, a(5) = a(4) + a(3) = 5 + 3 = 8. Since 6 is a multiple of 6, a(6) = a(5) + a(4) + 1 = 8 + 5 + 1 = 14. - _Michael B. Porter_, Jul 26 2016
		

Crossrefs

Programs

  • Maple
    A131132:=proc(n) option remember; local t1; if n <= 2 then RETURN(1); fi: if n mod 6 = 1 then t1:=1 else t1:=0; fi: procname(n-1)+procname(n-2)+t1; end; [seq(A131132(n), n=1..100)]; # N. J. A. Sloane, May 25 2008; Typo corrected by R. J. Mathar, May 30 2008
  • Mathematica
    Print[Table[Round[(1 + Sqrt[5])/8 Fibonacci[n + 3]], {n, 0, 50}]] ;
    Print[RecurrenceTable[{c[n] == c[n - 1] + c[n - 2] + c[n - 6] - c[n - 7] - c[n - 8], c[0] == 1, c[1] == 1, c[2] == 2, c[3] == 3, c[4] == 5, c[5] == 8, c[6] == 14, c[7] == 22}, c, {n, 0, 50}]] ;  (* John M. Campbell, Jul 07 2016 *)
    LinearRecurrence[{1, 1, 0, 0, 0, 1, -1, -1}, {1, 1, 2, 3, 5, 8, 14, 22}, 40] (* Vincenzo Librandi, Jul 07 2016 *)

Formula

O.g.f.: 1/((1-x^6)(1 - x - x^2)). - R. J. Mathar, May 30 2008
a(n) = ((-1)^n-1)/6 + A099837(n+3)/12 + A000045(n+4)/4 + A057079(n)/12. - R. J. Mathar, Dec 07 2010
a(n) = floor(A066983(n+4)/3). - Gary Detlefs, Dec 19 2010
a(n) = round((1 + sqrt(5))/8 A000045(n+3)). - John M. Campbell, Jul 06 2016
a(n) = (number of compositions of n consisting of only 1 or 2 or 6) - (number of compositions with only 7 or ((1 or 2) and 7)) - (number of compositions with only 8 or ((1 or 2) and 8)). The "or" is inclusive. - Gregory L. Simay, May 25 2017

Extensions

More specific name from R. J. Mathar, Dec 09 2009

A036605 a(n) = a(n-2) + 2*a(n-3) + a(n-4).

Original entry on oeis.org

1, 4, 4, 7, 13, 19, 31, 52, 82, 133, 217, 349, 565, 916, 1480, 2395, 3877, 6271, 10147, 16420, 26566, 42985, 69553, 112537, 182089, 294628, 476716, 771343, 1248061, 2019403, 3267463, 5286868, 8554330, 13841197, 22395529, 36236725
Offset: 0

Views

Author

Keywords

References

  • D. E. Knuth, Art of Computer Programming, Vol. 3, Sect. 5.4.2, Eq. (25).

Crossrefs

Cf. A004695.

Programs

Formula

3 * [Fibonacci(n+2)/2] + 1. - Ralf Stephan, Dec 02 2004
a(n) = (A099837(n+2)+A022086(n+2))/2. G.f. ( -1-4*x-3*x^2-x^3 ) / ( (1+x+x^2)*(x^2+x-1) ). - R. J. Mathar, Mar 21 2011

A081410 a(n) = a(n-1) + a(n-2) + n (mod 3), with a(1)=a(2)=1.

Original entry on oeis.org

1, 1, 2, 4, 8, 12, 21, 35, 56, 92, 150, 242, 393, 637, 1030, 1668, 2700, 4368, 7069, 11439, 18508, 29948, 48458, 78406, 126865, 205273, 332138, 537412, 869552, 1406964, 2276517, 3683483, 5960000, 9643484, 15603486, 25246970, 40850457
Offset: 1

Views

Author

Benoit Cloitre, Apr 20 2003

Keywords

Crossrefs

Cf. A004695.

Programs

  • GAP
    a:=[1,1,2,4,8];; for n in [6..40] do a[n]:=a[n-1]+a[n-2]+a[n-3] -a[n-4]-a[n-5]; od; a; # G. C. Greubel, Aug 15 2019
  • Magma
    R:=PowerSeriesRing(Integers(), 40); Coefficients(R!( (1+2*x^4)/((1-x^3)*(1-x-x^2)) )); // G. C. Greubel, Aug 15 2019
    
  • Maple
    seq(coeff(series((1+2*x^4)/((1-x^3)*(1-x-x^2)), x, n+1), x, n), n = 0 .. 40); # G. C. Greubel, Aug 15 2019
  • Mathematica
    RecurrenceTable[{a[1]==a[2]==1,a[n]==a[n-1]+a[n-2]+Mod[n,3]},a,{n,40}] (* or *) LinearRecurrence[{1,1,1,-1,-1},{1,1,2,4,8},40] (* Harvey P. Dale, Feb 01 2013 *)
  • PARI
    my(x='x+O('x^40)); Vec((1+2*x^4)/((1-x^3)*(1-x-x^2))) \\ G. C. Greubel, Aug 15 2019
    
  • Sage
    def A081410_list(prec):
        P. = PowerSeriesRing(ZZ, prec)
        return P((1+2*x^4)/((1-x^3)*(1-x-x^2))).list()
    A081410_list(30) # G. C. Greubel, Aug 15 2019
    

Formula

a(n) = floor(C*F(n)) + b(n) where C=(9-sqrt(5))/4, F(n) is the n-th Fibonacci number and b(n) is the 6-periodic sequence (0, 0, -1, -1, 0, -1).
G.f.: (1 + 2*x^4)/((1-x^3)*(1-x-x^2)).
a(1)=1, a(2)=1, a(3)=2, a(4)=4, a(5)=8, a(n) = a(n-1) +a(n-2) +a(n-3) - a(n-4) -a(n-5). - Harvey P. Dale, Feb 01 2013
Showing 1-10 of 20 results. Next