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-4 of 4 results.

A024996 Triangular array, read by rows: second differences in n,n direction of trinomial array A027907.

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 2, 0, 1, 1, 1, 3, 2, 3, 1, 1, 1, 2, 5, 6, 8, 6, 5, 2, 1, 1, 3, 8, 13, 19, 20, 19, 13, 8, 3, 1, 1, 4, 12, 24, 40, 52, 58, 52, 40, 24, 12, 4, 1, 1, 5, 17, 40, 76, 116, 150, 162, 150, 116, 76, 40, 17, 5, 1, 1, 6, 23, 62, 133, 232, 342, 428, 462, 428, 342, 232, 133, 62, 23, 6
Offset: 0

Views

Author

Keywords

Comments

For n > 2, T(n,k) is the number of integer strings s(0), ..., s(n) such that s(n) = n - k, s(0) = 0, |s(i) - s(i-1)| = 1 for i = 1,2 and <= 1 for i >= 3.

Examples

			                  1
               1  0  1
            1  0  2  0  1
         1  1  3  2  3  1  1
      1  2  5  6  8  6  5  2  1
   1  3  8 13 19 20 19 13  8  3  1
		

Crossrefs

First differences in n, n direction of array A025177.
Central column is essentially A024997, other columns are A024998, A026069, A026070, A026071. Row sums are in A025579.

Programs

  • Julia
    using Nemo
    function A024996Expansion(prec)
        R, t = PolynomialRing(ZZ, "t")
        S, x = PowerSeriesRing(R, prec+1, "x")
        ser = divexact(x^2*t^3 + x^2*t + x*t - 1, x*t^2 + x*t + x - 1)
        L = zeros(ZZ, prec^2)
        for k ∈ 0:prec-1, n ∈ 0:2*k
            L[k^2+n+1] = coeff(coeff(ser, k), n)
        end
        L
    end
    A024996Expansion(8) |> println # Peter Luschny, Jun 25 2020
  • Maple
    A024996 := proc(n,k)
        option remember;
        if n < 0 or k < 0 or k > 2*n then
            0 ;
        elif n <= 2 then
            if k = 2*n or k = 0 then
                1;
            elif k = 2*n-1 or k = 1 then
                0;
            elif k =2 then
                2;
            end if;
        else
            procname(n-1,k-1)+procname(n-1,k-2)+procname(n-1,k) ;
        end if;
    end proc: # R. J. Mathar, Jun 23 2013
    seq(seq(A024996(n,k), k=0..2*n), n=0..11); # added by Georg Fischer, Jun 24 2020
  • Mathematica
    nmax = 10; CoefficientList[CoefficientList[Series[y*x + (1 - y*x)^2/(1 - x*(1 + y + y^2)), {x, 0, nmax}, {y, 0, 2*nmax}], x], y] // Flatten (* G. C. Greubel, May 22 2017; amended by Georg Fischer, Jun 24 2020 *)
  • PARI
    T(n,k)=if(n<0||k<0||k>2*n,0,if(n==0,1,if(n==1,[1,0,1][k+1],if(n==2,[1,0,2,0,1][k+1],T(n-1,k-2)+T(n-1,k-1)+T(n-1,k))))) \\ Ralf Stephan, Jan 09 2004
    nmax=8; for(n=0, nmax, for(k=0, 2*n, print1(T(n,k),","))) \\ added by _Georg Fischer, Jun 24 2020
    

Formula

T(n, k) = T(n-1, k-2) + T(n-1, k-1) + T(n-1, k), starting with [1], [1, 0, 1], [1, 0, 2, 0, 1].
G.f.: y*z + (1-y*z)^2 / (1-z*(1+y+y^2)). - Ralf Stephan, Jan 09 2005 [corrected by Peter Luschny, Jun 25 2020]

Extensions

Edited by Ralf Stephan, Jan 09 2004
Offset corrected by R. J. Mathar, Jun 23 2013

A073724 a(n) = (4^(n+1) + 6n + 5)/9.

Original entry on oeis.org

1, 3, 9, 31, 117, 459, 1825, 7287, 29133, 116515, 466041, 1864143, 7456549, 29826171, 119304657, 477218599, 1908874365, 7635497427, 30541989673, 122167958655, 488671834581, 1954687338283, 7818749353089, 31274997412311
Offset: 0

Views

Author

Wouter Meeussen, Sep 01 2002

Keywords

Comments

a(n) is the number of times a disk is moved from peg 1 to peg 2 during a move of a tower of 2n or (2n-1) disks from peg 1 to peg 2 ("Tower of Hanoi" problem). Binomial transform of A025579.
An approximation to A091841.

Examples

			Moving a tower of 4 disks = 2^4 - 1 moves, coded {1,0,5,1,2,3,1,0,5,4,2,5,1,0,5}. The move from peg 1 to peg 2 has code "0" and this occurs 3 times. For 3 disks we also find 3 zeros in {0,1,3,0,4,5,0}. Hence a(2)=3. The coding corresponds to the rank of the permutation {'from peg' 1, 'to peg' 2, 'by peg' 3} or {1,2,3} with rank 0.
		

Crossrefs

Cf. A001045, A002450, A007583, A020988, A025579, A047849 (first differences), A090822, A091841.

Programs

  • Magma
    [(4^(n+1)+6*n+5)/9: n in [0..40] ]; // Vincenzo Librandi, Apr 28 2011
  • Mathematica
    Table[(4^(n+1)+6n+5)/9, {n, 0, 24}]
  • PARI
    a(n)=(4*4^n+6*n+5)/9
    
  • PARI
    a(n)=polcoeff((1-3*x)/(1-4*x)/(1-x)^2+x*O(x^n),n)
    

Formula

G.f.: (1-3*x)/((1-4*x)*(1-x)^2).
a(n) = Sum_{k=0..n} A047849(k). - L. Edson Jeffery, May 01 2021
From Elmo R. Oliveira, Dec 11 2023: (Start)
a(n) = 6*a(n-1) - 9*a(n-2) + 4*a(n-3) for n>2.
E.g.f.: (1/9)*(4*(exp(4*x)) + 6*x*exp(x) + 5*exp(x)). (End)

A095342 Number of elements in n-th string generated by a Kolakoski(5,1) rule starting with a(1)=1.

Original entry on oeis.org

1, 1, 5, 5, 17, 25, 61, 109, 233, 449, 917, 1813, 3649, 7273, 14573, 29117, 58265, 116497, 233029, 466021, 932081, 1864121, 3728285, 7456525, 14913097, 29826145, 59652341, 119304629, 238609313, 477218569, 954437197, 1908874333, 3817748729
Offset: 1

Views

Author

Benoit Cloitre, Jun 03 2004

Keywords

Comments

Each string is derived from the previous string using the Kolakoski(5,1) rule and the additional condition: "string begins with 1 if previous string ends with 5 and vice versa". The strings are 1 -> 5 -> 11111 -> 51515 -> 11111511111511111 -> ... and each one contains 1,1,5,5,17,... elements.
Equals inverse binomial transform of A025579. - Gary W. Adamson, Mar 04 2010

Crossrefs

Cf. A025579 . - Gary W. Adamson, Mar 04 2010

Programs

  • GAP
    List([1..35], n-> (2^(n+2) + (-1)^n*(5-6*n))/9); # G. C. Greubel, Dec 26 2019
  • Magma
    [(2^(n+2) + (-1)^n*(5-6*n))/9: n in [1..35]]; // G. C. Greubel, Dec 26 2019
    
  • Maple
    seq( (2^(n+2) + (-1)^n*(5-6*n))/9, n=1..35); # G. C. Greubel, Dec 26 2019
  • Mathematica
    Table[(2^(n+2) + (-1)^n*(5-6*n))/9, {n,35}] (* G. C. Greubel, Dec 26 2019 *)
  • PARI
    vector(35, n, (2^(n+2) + (-1)^n*(5-6*n))/9) \\ G. C. Greubel, Dec 26 2019
    
  • Sage
    [(2^(n+2) + (-1)^n*(5-6*n))/9 for n in (1..35)] # G. C. Greubel, Dec 26 2019
    

Formula

a(1) = a(2) = 1, a(n) = a(n-1) + 2*a(n-2) - 2*(-1)^n.
From R. J. Mathar, Apr 01 2010: (Start)
G.f.: x*(1+x+2*x^2)/((1-2*x)*(1+x)^2).
a(n) = (2^(n+2) + (-1)^n*(5-6*n))/9. (End)
E.g.f.: (exp(2*x) - 9 + (5+6*x)*exp(-x))/9. - G. C. Greubel, Dec 26 2019

A202337 Range of A062723.

Original entry on oeis.org

1, 2, 6, 12, 36, 108, 324, 972, 2916, 8748, 26244, 78732, 236196, 708588, 2125764, 6377292, 19131876, 57395628, 172186884, 516560652, 1549681956, 4649045868, 13947137604, 41841412812, 125524238436, 376572715308, 1129718145924, 3389154437772, 10167463313316
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 17 2011

Keywords

Comments

Subsequence of A000792.
Apparently a(n) = A052156(n - 1) for n >= 4. - Georg Fischer, Mar 26 2019

Crossrefs

Programs

  • Haskell
    a202337 n = a202337_list !! (n-1)
    a202337_list = f a062723_list where
       f (x:xs'@(x':xs)) = if x == x' then f xs' else x : f xs'

Formula

From Colin Barker, Mar 26 2019: (Start)
G.f.: x*(1 - x - 6*x^3) / (1 - 3*x).
a(n) = 4*3^(n-3) for n>3.
a(n) = 3*a(n-1) for n>4.
(End)
Showing 1-4 of 4 results.