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

A092582 Triangle read by rows: T(n,k) is the number of permutations p of [n] having length of first run equal to k.

Original entry on oeis.org

1, 1, 1, 3, 2, 1, 12, 8, 3, 1, 60, 40, 15, 4, 1, 360, 240, 90, 24, 5, 1, 2520, 1680, 630, 168, 35, 6, 1, 20160, 13440, 5040, 1344, 280, 48, 7, 1, 181440, 120960, 45360, 12096, 2520, 432, 63, 8, 1, 1814400, 1209600, 453600, 120960, 25200, 4320, 630, 80, 9, 1
Offset: 1

Views

Author

Emeric Deutsch and Warren P. Johnson (wjohnson(AT)bates.edu), Apr 10 2004

Keywords

Comments

Row sums are the factorial numbers (A000142). First column is A001710.
T(n,k) = number of permutations of [n] in which 1,2,...,k is a subsequence but 1,2,...,k,k+1 is not. Example: T(4,2)=8 because 1324, 1342, 1432, 4132, 3124, 3142, 3412 and 4312, are the only permutations of [4] in which 12 is a subsequence but 123 is not. - Emeric Deutsch, Nov 12 2004
T(n,k) is the number of deco polyominoes of height n with k cells in the last column. (A deco polyomino is a directed column-convex polyomino in which the height, measured along the diagonal, is attained only in the last column). - Emeric Deutsch, Jan 06 2005
T(n,k) is the number of permutations p of [n] for which the smallest i such that p(i)Emeric Deutsch, Feb 23 2008
Adding columns 2,4,6,... one obtains the derangement numbers 0,1,2,9,44,... (A000166). See the Bona reference (p. 118, Exercises 41,42). - Emeric Deutsch, Feb 23 2008
Matrix inverse of A128227*A154990. - Mats Granvik, Feb 08 2009
Differences in the columns of A173333 which counts the n-permutations with an initial ascending run of length at least k. - Geoffrey Critzer, Jun 18 2017
The triangle with each row reversed is A130477. - Michael Somos, Jun 25 2017

Examples

			T(4,3) = 3 because 1243, 1342 and 2341 are the only permutations of [4] having length of first run equal to 3.
     1;
     1,    1;
     3,    2,   1;
    12,    8,   3,   1;
    60,   40,  15,   4,  1;
   360,  240,  90,  24,  5,  1;
  2520, 1680, 630, 168, 35,  6,  1;
  ...
		

References

  • M. Bona, Combinatorics of Permutations, Chapman&Hall/CRC, Boca Raton, Florida, 2004.

Crossrefs

Programs

  • GAP
    Flat(List([1..11],n->Concatenation([1],List([1..n-1],k->Factorial(n)*k/Factorial(k+1))))); # Muniru A Asiru, Jun 10 2018
    
  • Magma
    A092582:= func< n,k | k eq n select 1 else k*Factorial(n)/Factorial(k+1) >;
    [A092582(n,k): k in [1..n], n in [1..12]]; // G. C. Greubel, Sep 06 2022
    
  • Mathematica
    Drop[Drop[Abs[Map[Select[#, # < 0 &] &, Map[Differences, nn = 10; Range[0, nn]! CoefficientList[Series[(Exp[y x] - 1)/(1 - x), {x, 0, nn}], {x, y}]]]], 1], -1] // Grid (* Geoffrey Critzer, Jun 18 2017 *)
  • PARI
    {T(n, k) = if( n<1 || k>n, 0, k==n, 1, n! * k /(k+1)!)}; /* Michael Somos, Jun 25 2017 */
    
  • SageMath
    def A092582(n,k): return 1 if (k==n) else k*factorial(n)/factorial(k+1)
    flatten([[A092582(n,k) for k in (1..n)] for n in (1..12)]) # G. C. Greubel, Sep 06 2022

Formula

T(n, k) = n!*k/(k+1)! for k
Inverse of:
1;
-1, 1;
-1, -2, 1;
-1, -2, -3, 1;
-1, -2, -3, -4, 1;
... where A002260 = (1; 1,2; 1,2,3; ...). - Gary W. Adamson, Feb 22 2012
T(2n,n) = A092956(n-1) for n>0. - Alois P. Heinz, Jun 19 2017
From Alois P. Heinz, Dec 17 2021: (Start)
Sum_{k=1..n} k * T(n,k) = A002627(n).
|Sum_{k=1..n} (-1)^k * T(n,k)| = A055596(n) for n>=1. (End)
From G. C. Greubel, Sep 06 2022: (Start)
T(n, 1) = A001710(n).
T(n, 2) = 2*A001715(n) + [n=2]/3, n >= 2.
T(n, 3) = 3*A001720(n) + [n=3]/4, n >= 3.
T(n, 4) = 4*A001725(n) + [n=4]/5, n >= 4.
T(n, n-1) = A000027(n-1).
T(n, n-2) = A005563(n-1), n >= 3. (End)
Sum_{k=0..n} (k+1) * T(n,k) = A000522(n). - Alois P. Heinz, Apr 28 2023

A096654 Denominators of self-convergents to 1/(e-2).

Original entry on oeis.org

1, 2, 8, 38, 222, 1522, 11986, 106542, 1054766, 11506538, 137119578, 1772006854, 24681524038, 368577425634, 5874202721042, 99515904921182, 1785757627196766, 33835407673201882, 675016383080377546, 14143200407398386678, 310507536216973671158, 7128173005328786885714
Offset: 0

Author

Clark Kimberling, Jul 01 2004

Keywords

Comments

The self-continued fraction of r>0 is here introduced as the sequence (b(0), b(1), b(2), ...) defined as follows: put r(0)=r, b(0)=[r(0)] and for n>=1, put r(n)=b(n-1)/(r(n-1)-b(n-1)) and b(n)=[r(n)]. This differs from simple continued fraction, for which r(n)=1/(r(n-1)-b(n-1)). Now r=lim(p(n)/q(n)), where p(0)=b(1), q(0)=1, p(1)=b(0)(b(1)+1), q(1)=b(1) and for n>=2, p(n)=b(n)*p(n-1)+b(n-1)*p(n-2), q(n)=b(n)*q(n-1)+b(n-1)*q(n-2); p(0),p(1),... are the numerators of the self-convergents to r; q(0),q(1),... are the denominators of the self-convergents to r. Thus A096654 is given by a(n)=(n+1)*a(n-1)+n*a(n-2), a(0)=1, a(1)=2.
Number of increasing runs of odd length in all permutations of [n+1]. Example: a(2) = 8 because we have (123), 13(2), (3)12, (2)13, 23(1), (3)(2)(1) (the runs of odd length are shown between parentheses). - Emeric Deutsch, Aug 29 2004

Examples

			a(2)=q(2)=3*2+2*1=8, a(3)=q(3)=4*8+3*2=38. The convergents p(0)/q(0) to p(4)/q(4) are 1/1, 3/2, 11/8, 53/38, 309/222.
		

Programs

  • Maple
    G:=(3-x-2*(1+x)*exp(-x))/(1-x)^3: Gser:=series(G,x=0,22): 1,seq(n!*coeff(Gser,x^n),n=1..21);
  • Mathematica
    With[{g = (3 - x - 2*(1 + x)*Exp[-x])/(1 - x)^3},CoefficientList[Series[g, {x, 0, 21}], x]*Table[k!, {k, 0, 21}]] (* Shenghui Yang, Oct 15 2024 *)
  • PARI
    x='x+O('x^66); Vec(serlaplace((3-x-2*(1+x)*exp(-x))/(1-x)^3)) /* Joerg Arndt, Aug 06 2012 */
  • Python
    prpr = 1
    prev = 2
    for n in range(2, 77):
        print(prpr, end=', ')
        curr = (n+1)*prev + n*prpr
        prpr = prev
        prev = curr
    # Alex Ratushnyak, Aug 05 2012
    

Formula

a(n) = (n+1)*a(n-1) + n*a(n-2), with a(0)=1, a(1)=2. - Alex Ratushnyak, Aug 05 2012
E.g.f.: (3-x-2*(1+x)*exp(-x))/(1-x)^3. - Emeric Deutsch, Aug 29 2004
From Gary Detlefs, Apr 12 2010: (Start)
a(n) = A055596(n+1) + A055596(n+2).
a(n) = (n+1)!+(n+2)! -2*( A000166(n+1) + A000166(n+2)).
a(n) = (n+1)! - 2*floor(((n+1)!+1)/e) + (n+2)!-2*floor(((n+2)!+1)/e). (End)
a(n) = ((n+3)!-2*floor(((n+3)!+1)/e))/(n+2). - Gary Detlefs, Jul 11 2010 [corrected by Gary Detlefs, Oct 26 2020]
a(n) = Sum_{k=1..n+1} A097591(n+1,k). - Alois P. Heinz, Jul 03 2019

Extensions

More terms from Emeric Deutsch, Aug 29 2004

A227918 Sum over all permutations beginning and ending with ascents, and without double ascents on n elements and each permutation contributes 2 to the power of the number of double descents.

Original entry on oeis.org

1, 0, 5, 22, 137, 956, 7653, 68874, 688745, 7576192, 90914309, 1181886014, 16546404201, 248196063012, 3971137008197, 67509329139346, 1215167924508233, 23088190565656424, 461763811313128485, 9697040037575698182, 213334880826665360009, 4906702259013303280204, 117760854216319278724901
Offset: 2

Author

Richard Ehrenborg, Oct 08 2013

Keywords

Examples

			a(4) = 5 since the sum is over the five permutations 1324, 1423, 2314, 2413 and 3412, and each of them contribute 1 to the sum, since none of them has a double descent.
		

Crossrefs

Programs

  • Mathematica
    a[2] = 1; a[n_] := n*a[n - 1] + 1 + 4 (-1)^n;  Table[a[n], {n, 2, 20}] (* Wesley Ivan Hurt, May 04 2014 *)

Formula

E.g.f.: (exp(x) - 4 + 4*exp(-x))/(1-x) - 1 + 2*x.
Closest integer to (e - 4 + 4/e)*n! for n > 7.
a(n) = n*a(n-1) + 1 + 4*(-1)^n.
Conjecture: a(n) -n*a(n-1) -a(n-2) +(n-2)*a(n-3) = 0. - R. J. Mathar, Jul 17 2014

A230071 Sum over all permutations without double ascents on n elements and each permutation contributes 2 raised to the power of the number of double descents.

Original entry on oeis.org

0, 0, 2, 6, 26, 130, 782, 5474, 43794, 394146, 3941462, 43356082, 520272986, 6763548818, 94689683454, 1420345251810, 22725524028962, 386333908492354, 6954010352862374, 132126196704385106, 2642523934087702122, 55493002615841744562, 1220846057548518380366
Offset: 0

Author

Richard Ehrenborg, Oct 08 2013

Keywords

Examples

			For n=3 the a(3)= 6 since the 4 permutations 132, 213, 231, 312 all contribute 1 and 321 contributes 2 to the sum. Note when n=4, the permutation 4321 contributes 4 since it has two double descents.
G.f. = 2*x^2 + 6*x^3 + 26*x^4 + 130*x^5 + 782*x^6 + 5474*x^7 + 43794*x^8 + ...
		

Crossrefs

Programs

  • Maple
    a := proc(n) if n < 2 then 0 elif n = 2 then 2 else (2-n)*a(n-3)+a(n-2)+n*a(n-1) fi end: seq(a(n), n=0..9); # Peter Luschny, May 30 2014
  • Mathematica
    a[0] = 0; a[n_] := a[n] = n a[n-1] + (-1)^n + 1;
    Array[a, 23, 0] (* Jean-François Alcover, Jul 08 2019, after A080227 *)

Formula

E.g.f.: (exp(x)+exp(-x)-2)/(1-x).
a(n) = closest integer to (e-2+1/e)*n! for n > 3.
a(n) = (2-n)*a(n-3) + a(n-2) + n*a(n-1) for n > 2.
a(n) = 2*A080227(n).
a(n) = sum(0<=kA002627(k)). - Peter Luschny, May 30 2014
0 = a(n)*(+a(n+1) - a(n+2) - 3*a(n+3) + a(n+4)) + a(n+1)*(+a(n+1) + a(n+2) - 2*a(n+3)) + a(n+2)*(+a(n+2) + a(n+3) - a(n+4)) + a(n+3)*(+a(n+3)) if n>=0. - Michael Somos, May 30 2014

Extensions

a(0) and a(1) prepended, partially edited. - Peter Luschny, May 30 2014

A355229 E.g.f. A(x) satisfies A'(x) = 1 - log(1-x) * A(x).

Original entry on oeis.org

0, 1, 0, 2, 3, 16, 65, 365, 2261, 16240, 131097, 1182013, 11779537, 128737088, 1532051287, 19731964705, 273556185109, 4062828620256, 64368863326717, 1083795820014261, 19327395713028985, 363940825109825200, 7216468161637890899, 150304143164083288441
Offset: 0

Author

Seiichi Manyama, Jun 25 2022

Keywords

Crossrefs

Programs

  • Mathematica
    nmax = 25; CoefficientList[Series[(1-x)^(1-x) / E^(1-x) * Integrate[E^(1-x) / (1-x)^(1-x), x], {x, 0, nmax}], x] * Range[0, nmax]! (* Vaclav Kotesovec, Jun 25 2022 *)
  • PARI
    a_vector(n) = my(v=vector(n)); v[1]=1; for(i=1, n-1, v[i+1]=sum(j=1, i-1, (j-1)!*binomial(i, j)*v[i-j])); concat(0, v);

Formula

a(0) = 0, a(1) = 1; a(n+1) = Sum_{k=1..n-1} (k-1)! * binomial(n,k) * a(n-k).
E.g.f.: (1-x)^(1-x) / exp(1-x) * Integral(exp(1-x) / (1-x)^(1-x) dx). - Vaclav Kotesovec, Jun 25 2022

A216441 a(n) = n! mod !n.

Original entry on oeis.org

0, 0, 6, 32, 190, 1332, 10654, 95888, 958878, 10547660, 126571918, 1645434936, 23036089102, 345541336532, 5528661384510, 93987243536672, 1691770383660094, 32143637289541788, 642872745790835758, 13500327661607550920, 297007208555366120238, 6831165796773420765476
Offset: 2

Author

Michel Lagneau, Sep 07 2012

Keywords

Comments

!n is a subfactorial number (A000166).

Examples

			a(5) = 5! mod !5 = 120 mod 44 = 32. - _Indranil Ghosh_, Feb 15 2017
		

Crossrefs

Programs

  • Maple
    with(numtheory): f:=n->sum(n!*(((-1)^k)*1/k!), k=0..n):for n from 1 to 30 do:  x:=irem(n!,f(n)): printf(`%d, `, x):od:
  • Mathematica
    Table[Mod[n !, Subfactorial[n]],{n,100} ]

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

Original entry on oeis.org

1, 0, 4, 24, 224, 2480, 32448, 488992, 8343040, 158976576, 3346392320, 77118115712, 1931148192768, 52214924020480, 1516090021970944, 47049148379742720, 1554087628854837248, 54438650425975718912, 2015738569973900021760, 78666734375195278145536, 3227298917806767126691840
Offset: 0

Author

Gary Detlefs, Jul 18 2010

Keywords

Examples

			a(2)= 4*(0+1)=4, a(3)=6*(4+0)=24, a(4)=8*(24+4)=224...
		

Crossrefs

Cf. A055596.

Formula

D-finite with recurrence: 2*n*a(n-2) + 2*n*a(n - 1) - a(n) = 0. Georg Fischer, Mar 31 2025

Extensions

Definition corrected by Bruno Berselli, Jul 20 2010
Typo in a(7) corrected by Georg Fischer, Mar 31 2025

A361938 a(0)=1, a(1)=0; a(n) = floor(n/2)*(a(n-1) + a(n-2)).

Original entry on oeis.org

1, 0, 1, 1, 4, 10, 42, 156, 792, 3792, 22920, 133560, 938880, 6434640, 51614640, 406344960, 3663676800, 32560174080, 326014657920, 3227173488000, 35531881459200, 387590549472000, 4654346740243200, 55461310186867200, 721387883125324800, 9322190319746304000
Offset: 0

Author

Davide Oliveri, Mar 31 2023

Keywords

Comments

For n <= 1000000, n prime divides a(n) only when n=5 and n composite does not divide a(n) only when n = 9. Is this always so?

Examples

			a(0) = 1;
a(1) = 0;
a(2) = floor(2/2)*(a(1) + a(0)) = 1;
a(3) = floor(3/2)*(a(2) + a(1)) = 1;
a(4) = floor(4/2)*(a(3) + a(2)) = 4;
a(5) = floor(5/2)*(a(4) + a(3)) = 10.
		

Crossrefs

Cf. A055596.

Programs

  • Mathematica
    a[0] = 1; a[1] = 0; a[n_] := a[n] = Floor[n/2] * (a[n - 1] + a[n - 2]); Array[a, 30, 0] (* Amiram Eldar, Apr 05 2023 *)
  • Python
    def seqx_it(n):
      a0 = 1
      a1 = 0
      sequence_store = [a0,a1]
      for i in range (2,n):
        a2 = (i//2) * (a1 + a0)
        sequence_store.append(a2)
        a0 = a1
        a1 = a2
      return sequence_store

Formula

a(0)=1, a(1)=0; a(n) = floor(n/2)*(a(n-1) + a(n-2)).
Showing 1-8 of 8 results.