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

A003149 a(n) = Sum_{k=0..n} k!*(n - k)!.

Original entry on oeis.org

1, 2, 5, 16, 64, 312, 1812, 12288, 95616, 840960, 8254080, 89441280, 1060369920, 13649610240, 189550368000, 2824077312000, 44927447040000, 760034451456000, 13622700994560000, 257872110354432000, 5140559166898176000, 107637093007589376000, 2361827297364885504000
Offset: 0

Views

Author

Keywords

Comments

From Michael Somos, Feb 14 2002: (Start)
The sequence is the resistance between opposite corners of an (n+1)-dimensional hypercube of unit resistors, multiplied by (n+1)!.
The resistances for n+1 = 1,2,3,... are 1, 1, 5/6, 2/3, 8/15, 13/30, 151/420, 32/105, 83/315, 73/315, 1433/6930, ... (see A046878/A046879). (End)
Number of {12,21*,2*1}-avoiding signed permutations in the hyperoctahedral group.
a(n) is the sum of the reciprocals of the binomial coefficients C(n,k), multiplied by n!; example: a(4) = 4!*(1/1 + 1/4 + 1/6 + 1/4 + 1/1) = 64. - Philippe Deléham, May 12 2005
a(n) is the number of permutations on [n+1] that avoid the pattern 13-2|. The absence of a dash between 1 and 3 means the "1" and "3" must be consecutive in the permutation; the vertical bar means the "2" must occur at the end of the permutation. For example, 24153 fails to avoid this pattern: 243 is an offending subpermutation. - David Callan, Nov 02 2005
n!/a(n) is the probability that a random walk on an (n+1)-dimensional hypercube will visit the diagonally opposite vertex before it returns to its starting point. 2^n*a(n)/n! is the expected length of a random walk from one vertex of an (n+1)-dimensional hypercube to the diagonally opposite vertex (a walk which may include one or more passes through the starting point). These "random walk" examples are solutions to IBM's "Ponder This" puzzle for April, 2006. - Graeme McRae, Apr 02 2006
a(n) is the number of strong fixed points in all permutations of {1,2,...,n+1} (a permutation p of {1,2,...,n} is said to have j as a strong fixed point (splitter) if p(k)j for k>j). Example: a(2)=5 because the permutations of {1,2,3}, with marked strong fixed points, are: 1'2'3', 1'32, 312, 213', 231 and 321. - Emeric Deutsch, Oct 28 2008
Coefficients in the asymptotic expansion of exp(-2*x)*Ei(x)^2 for x -> inf, where Ei(x) is the exponential integral. - Vladimir Reshetnikov, Apr 24 2016

References

  • I. P. Goulden and D. M. Jackson, Combinatorial Enumeration, Wiley, N.Y., 1983, (1.1.11 b, p.342).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • R. P. Stanley, Enumerative Combinatorics, Volume 1 (1986), p. 49. [From Emeric Deutsch, Oct 28 2008]

Crossrefs

Cf. A052186, A006932, A145878. - Emeric Deutsch, Oct 28 2008
Cf. A324495, A324496, A324497 (problem similar to the random walks on the hypercube).

Programs

  • GAP
    F:=Factorial;; List([0..20], n-> Sum([0..n], k-> F(k)*F(n-k)) ); # G. C. Greubel, Dec 29 2019
    
  • Magma
    F:=Factorial; [ (&+[F(k)*F(n-k): k in [0..n]]): n in [0..20]]; // G. C. Greubel, Dec 29 2019
    
  • Maple
    seq( add(k!*(n-k)!, k=0..n), n=0..20); # G. C. Greubel, Dec 29 2019
    # second Maple program:
    a:= proc(n) option remember; `if`(n<2, n+1,
          ((3*n+1)*a(n-1)-n^2*a(n-2))/2)
        end:
    seq(a(n), n=0..22);  # Alois P. Heinz, Aug 08 2025
  • Mathematica
    Table[Sum[k!(n-k)!,{k,0,n}],{n,0,20}] (* Harvey P. Dale, Mar 28 2012 *)
    Table[(n+1)!/2^n*Sum[2^k/(k+1),{k,0,n}],{n,0,20}] (* Vaclav Kotesovec, Oct 27 2012 *)
    Round@Table[-2 (n+1)! Re[LerchPhi[2, 1, n+2]], {n, 0, 20}] (* Vladimir Reshetnikov, Nov 12 2015 *)
    Table[(n+1)!*Sum[Binomial[n+1, 2*j+1]/(2*j+1), {j, 0, n}]/2^n, {n, 0, 20}] (* Vaclav Kotesovec, Dec 04 2015 *)
    Series[Exp[-2x] ExpIntegralEi[x]^2, {x, Infinity, 20}][[3]] (* Vladimir Reshetnikov, Apr 24 2016 *)
    Table[2*(-1)^n * Sum[(2^k - 1) * StirlingS1[n, k] * BernoulliB[k], {k, 0, n}], {n, 1, 25}] (* Vaclav Kotesovec, Oct 04 2022 *)
  • PARI
    a(n)=sum(k=0,n,k!*(n-k)!)
    
  • PARI
    a(n)=if(n<0,0,(n+1)!*polcoeff(log(1-x+x^2*O(x^n))/(x/2-1),n+1))
    
  • PARI
    a(n) = my(A = 1, B = 1); for(k=1, n, B *= k; A = (n-k+1)*A + B); A \\ Mikhail Kurkov, Aug 08 2025
    
  • Python
    def a(n: int) -> int:
        if n < 2: return n + 1
        app, ap = 1, 2
        for i in range(2, n + 1):
            app, ap = ap, ((3 * i + 1) * ap - (i * i) * app) >> 1
        return ap
    print([a(n) for n in range(23)])  # Peter Luschny, Aug 08 2025
  • Sage
    f=factorial; [sum(f(k)*f(n-k) for k in (0..n)) for n in (0..20)] # G. C. Greubel, Dec 29 2019
    

Formula

a(n) = n! + ((n+1)/2)*a(n-1), n >= 1. - Leroy Quet, Sep 06 2002
a(n) = ((3n+1)*a(n-1) - n^2*a(n-2))/2, n >= 2. - David W. Wilson, Sep 06 2002; corrected by N. Sato, Jan 27 2010
G.f.: (Sum_{k>=0} k!*x^k)^2. - Vladeta Jovovic, Aug 30 2002
E.g.f: log(1-x)/(x/2 - 1) if offset 1.
Convolution of A000142 [factorial numbers] with itself. - Ross La Haye, Oct 29 2004
a(n) = Sum_{k=0..n+1} k*A145878(n+1,k). - Emeric Deutsch, Oct 28 2008
a(n) = A084938(n+2,2). - Philippe Deléham, Dec 17 2008
a(n) = 2*Integral_{t=0..oo} Ei(t)*exp(-2*t)*t^(n+1) where Ei is the exponential integral function. - Groux Roland, Dec 09 2010
Empirical: a(n-1) = 2^(-n)*(A103213(n) + n!*H(n)) with H(n) harmonic number of order n. - Groux Roland, Dec 18 2010; offset fixed by Vladimir Reshetnikov, Apr 24 2016
O.g.f.: 1/(1-I(x))^2 where I(x) is o.g.f. for A003319. - Geoffrey Critzer, Apr 27 2012
a(n) ~ 2*n!. - Vaclav Kotesovec, Oct 04 2012
a(n) = (n+1)!/2^n * Sum_{k=0..n} 2^k/(k+1). - Vaclav Kotesovec, Oct 27 2012
E.g.f.: 2/((x-1)*(x-2)) + 2*x/(x-2)^2*G(0) where G(k) = 1 + x*(2*k+1)/(2*(k+1) - 4*x*(k+1)^2/(2*x*(k+1) + (2*k+3)/G(k+1) )); (recursively defined continued fraction). - Sergei N. Gladkovskii, Dec 14 2012
a(n) = 2 * n! * (1 + Sum_{k>=1} A005649(k-1)/n^k). - Vaclav Kotesovec, Aug 01 2015
From Vladimir Reshetnikov, Nov 12 2015: (Start)
a(n) = -(n+1)!*Re(Beta(2; n+2, 0))/2^(n+1), where Beta(z; a, b) is the incomplete Beta function.
a(n) = -2*(n+1)!*Re(LerchPhi(2, 1, n+2)), where LerchPhi(z, s, a) is the Lerch transcendent. (End)
a(n) = (n+1)!*(H(n+1) + (n+1)*hypergeom([1, 1, -n], [2, 2], -1))/2^(n+1), where H(n) is the harmonic number. - Vladimir Reshetnikov, Apr 24 2016
Expansion of square of continued fraction 1/(1 - x/(1 - x/(1 - 2*x/(1 - 2*x/(1 - 3*x/(1 - 3*x/(1 - ...))))))). - Ilya Gutkovskiy, Apr 19 2017
a(n) = Sum_{k=0..n+1} (-1)^(n-k)*A226158(k)*Stirling1(n+1, k). - Mélika Tebni, Feb 22 2022
E.g.f.: x/((1-x)*(2-x))-(2*log(1-x))/(2-x)^2+1/(1-x). - Vladimir Kruchinin, Dec 17 2022

Extensions

More terms from Michel ten Voorde, Apr 11 2001

A052186 Number of permutations of [n] with no strong fixed points.

Original entry on oeis.org

1, 0, 1, 3, 14, 77, 497, 3676, 30677, 285335, 2928846, 32903721, 401739797, 5298600772, 75092880273, 1138261010851, 18378421938366, 314928827507717, 5708689036074089, 109145365739197964, 2195167574579322013, 46331767712354136479, 1023970009016490622478
Offset: 0

Views

Author

N. J. A. Sloane, Feb 04 2000

Keywords

Comments

A strong fixed point is a fixed point (or splitter) p(k)=k such that p(i) < k for i < k and p(j) > k for j > k.
Equals INVERTi transform of the factorials, n starting with 0. Triangle A144108 has row sums = n! with left border = A052186. - Gary W. Adamson, Sep 11 2008

References

  • Stanley, R. P., Enumerative Combinatorics, Volume 1 (1986), p. 49

Crossrefs

Cf. A144108, A000142. - Gary W. Adamson, Sep 11 2008
Column k=0 of A186373.

Programs

  • Maple
    t1 := add(n!*x^n, n=0..100): F := series(t1/(1+x*t1), x, 100): for i from 0 to 20 do printf(`%d, `, coeff(F, x, i)) od: # Zerinvary Lajos, Mar 22 2009
    # second Maple program:
    a:= proc(n) a(n):= -`if`(n<0, 1, add(a(n-i-1)*i!, i=0..n)) end:
    seq(a(n), n=0..25);  # Alois P. Heinz, May 21 2013
  • Mathematica
    m = 20; CoefficientList[ Series[ 1 / (x + 1/Sum[ n!*x^n, {n, 0, m}]), {x, 0, m}], x] (* Jean-François Alcover, Aug 30 2011, after Michael Somos *)
    nmax = 25; Rest[CoefficientList[Assuming[Element[x, Reals], Series[-1/(ExpIntegralEi[1/x]/E^(1/x) + 1), {x, 0, nmax+1}]], x]] (* Vaclav Kotesovec, Aug 05 2015 *)
  • PARI
    {a(n)=if(n<0, 0, polcoeff( 1/ (x+1/sum(k=0, n, k!*x^k, x*O(x^n))), n))} /* Michael Somos, Oct 11 2006 */

Formula

G.f.: F(x)/(1 + x*F(x)), F(x) = Sum_{n >= 0} n!*x^n.
a(0)=1, a(1)=0, a(n) = (n-2)*a(n-1) + Sum_{k=0..n-1} a(k)*a(n-1-k) + Sum_{k=0..n-2} a(k)*a(n-2-k) if n > 1. - Michael Somos, Oct 11 2006
G.f.: 1/(1-x^2/(1-3x-4x^2/(1-5x-9x^2/(1-7x-16x^2/(1-9x-25x^2/(1-... (continued fraction). - Paul Barry, Dec 09 2009
If p[i] = Stirling1(i,1) and if A is the Hessenberg matrix of order n defined by A[i,j] = p[j-i+1], (i <= j), A[i,j] = -1, (i=j+1), and A[i,j]=0 otherwise, then, for n >= 1, a(n-1) = (-1)^(n-1) det A. - Milan Janjic, May 08 2010
From Gary W. Adamson, Jul 22 2011: (Start)
a(n) = upper left term in (-1)*M^(n+1), M = an infinite square production matrix in which a column of (-1)'s is prepended to Pascal's triangle as follows:
-1, 1, 0, 0, 0, 0, ...
-1, 1, 1, 0, 0, 0, ...
-1, 1, 2, 1, 0, 0, ...
-1, 1, 3, 3, 1, 0, ...
-1, 1, 4, 6, 4, 1, ...
... (End)
G.f.: A(x) = 1/(1/G(0) + x); G(k) = 1 + x*(2*k+1)/(1 - 2*x*(k+1)/(2*x*(k+1) + 1/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, Dec 29 2011
G.f.: A(x) = 1/x = 1/(1+x)*(1+x/((1+x)*G(0)-x)); G(k) = 1 + x*(k+1) - x*(k+2)/G(k+1); (continued fraction Euler's kind, 1-step ). - Sergei N. Gladkovskii, Dec 29 2011
G.f.: 1/(G(0) + x) where G(k) = 1 - x*(k+1)/(1 - x*(k+1)/G(k+1) ); (recursively defined continued fraction). - Sergei N. Gladkovskii, Dec 19 2012
G.f.: 1/(1 - W(0)) where W(k) = x*(2*k+1) - 1 - x^2*(k+1)^2/W(k+1); (recursively defined continued fraction). - Sergei N. Gladkovskii, Dec 19 2012
G.f.: 1/(G(0) + x), where G(k)= 1 + x*k - x*(k+1)/G(k+1); (continued fraction). - Sergei N. Gladkovskii, Jul 03 2013
a(n) ~ n! * (1 - 2/n + 1/n^2 - 1/n^3 - 9/n^4 - 59/n^5 - 474/n^6 - 4560/n^7 - 50364/n^8 - 625385/n^9 - 8622658/n^10), for coefficients see A256168. - Vaclav Kotesovec, Mar 16 2015
a(n) = n! - Sum_{k=0..n-1} (n-k-1)!*a(k). - Pontus von Brömssen, Jul 10 2021
a(n) + A006932(n) = n!. - Pontus von Brömssen, Jul 10 2021

Extensions

Better description from James Sellers, Mar 13 2000

A145878 Triangle read by rows: T(n,k) is the number of permutations of [n] having k strong fixed points (0 <= k <= n).

Original entry on oeis.org

1, 0, 1, 1, 0, 1, 3, 2, 0, 1, 14, 6, 3, 0, 1, 77, 29, 9, 4, 0, 1, 497, 160, 45, 12, 5, 0, 1, 3676, 1031, 249, 62, 15, 6, 0, 1, 30677, 7590, 1603, 344, 80, 18, 7, 0, 1, 285335, 63006, 11751, 2214, 445, 99, 21, 8, 0, 1, 2928846, 583160, 97056, 16168, 2865, 552, 119, 24
Offset: 0

Views

Author

Emeric Deutsch, Oct 29 2008

Keywords

Comments

A permutation p of {1,2,...,n} is said to have j as a strong fixed point (splitter) if p(k) < j for k < j and p(k) > j for k > j.
T(n,k) is also the number of permutation graphs on n vertices with exactly k distinct dominating sets of size one. See the link by Theresa Baren, et al. -Daniel A. McGinnis, Oct 16 2018
The values T(k+r,k) are given as a polynomial expression in k when r is fixed, and the polynomial expressions can be calculated recursively. See the link by Theresa Baren, et al. -Daniel A. McGinnis, Oct 19 2018

Examples

			T(5,3) = 4 because we have 1'2'3'54, 1'2'435', 1'324'5' and 213'4'5' (the strong fixed points are marked).
Triangle starts:
   1;
   0,  1;
   1,  0,  1;
   3,  2,  0,  1;
  14,  6,  3,  0,  1;
  77, 29,  9,  4,  0,  1;
		

References

  • Stanley, R. P., Enumerative Combinatorics, Volume 1 (1986), p. 49.

Crossrefs

Row sums gives A000142.

Programs

  • Maple
    n:=7: sfix:=proc(p) local ct,i: ct:= 0: for i to nops(p) do if p[i]=i and `subset`({seq(p[j],j=1..i-1)},{seq(k,k=1..i-1)})=true then ct:=ct+1 else end if end do: ct end proc: with(combinat): P:=permute(n): s:=[seq(sfix(P[j]),j= 1..factorial(n))]: for i from 0 to n do a[i]:=0 end do: for j to factorial(n) do if s[j]=0 then a[0]:=a[0]+1 elif s[j]=1 then a[1]:=a[1]+1 elif s[j]=2 then a[2]:=a[2]+1 elif s[j]=3 then a[3]:=a[3]+1 elif s[j]=4 then a[4]:=a[4]+1 elif s[j]=5 then a[5]:=a[5]+1 elif s[j]=6 then a[6]:=a[6]+1 elif s[j]=7 then a[7]:= a[7]+1 elif s[j]=8 then a[8]:=a[8]+1 elif s[j]=9 then a[9]:=a[9]+1 elif s[j]= 10 then a[10]:=a[10]+1 end if end do: seq(a[k],k=0..n); # yields row m of the triangle, where m is the value of n specified at the beginning of the program
    n:=7: G:=1:for r from n to 2 by -1 do G:=1-(2*r-1)*z-(r^2*z^2)/G:od:G:=1/(1-t*z-z^2/G):
    Gser := simplify(series(G, z = 0, n+1)): for m from 0 to n do seq(coeff(coeff(Gser, z, m), t, k), k = 0 .. m) end do; # based on P. Barry's g.f.; yields sequence in triangular form
  • Mathematica
    nn=10;p=Sum[n!x^n,{n,0,nn}];i=1-1/p;CoefficientList[Series[1/(1-(i-x+y x)),{x,0,nn}],{x,y}]//Grid  (* Geoffrey Critzer, Apr 27 2012 *)

Formula

T(n,0) = A052186(n).
Sum_{k=1..n} T(n,k) = A006932(n).
Sum_{k=0..n} k*T(n,k) = A003149(n-1).
G.f.: 1/(1-xy-x^2/(1-3x-4x^2/(1-5x-9x^2/(1-7x-16x^2/(1-9x-25x^2/(1-... (continued fraction). - Paul Barry, Dec 09 2009
G.f.: 1/(1-(I(x)- x + y*x)) where I(x) is o.g.f. for A003319. - Geoffrey Critzer, Apr 27 2012
From Daniel A. McGinnis, Oct 15 2018: (Start)
T(n,k) = Sum_{i=1..n-k+1} T(n-i,k-1)*T(i-1,0).
T(3+k,k)=3k+3, T(4+k,k)=(k+1)(k+28)/2, T(5+k,k)=(k+1)(3k+77), T(6+k,k)=(k+1)(k^2+110k+2982)/6, T(7+k,k)=(k+1)(3k^2+235k+7352)/2 (previous conjectures).
See the link by Theresa Baren, et al. (End)

A346204 a(n) is the number of permutations on [n] with at least one strong fixed point and at least one small descent.

Original entry on oeis.org

0, 0, 2, 5, 24, 128, 795, 5686, 46090, 418519, 4213098, 46595650, 561773033, 7333741536, 103065052300, 1551392868821, 24902155206164, 424588270621876, 7663358926666175, 145967769353476594, 2926073829112697318, 61577929208485406331, 1357369100658321844470, 31276096500003460511422
Offset: 1

Views

Author

Keywords

Comments

A small descent in a permutation p is a position i such that p(i)-p(i+1)=1.
A strong fixed point is a fixed point (or splitter) p(k)=k such that p(i) < k for i < k and p(j) > k for j > k.

Examples

			For n=4, the a(4)=5 permutations on [4] with strong fixed points and small descents: {(1*, 2*, [4, 3]), (1*, [3, 2], 4*), (1*, <4, 3, 2>), ([2, 1], 3*, 4*), (<3, 2, 1>, 4*)}. *strong fixed point, []small descent, <>consecutive small descents.
		

References

  • E. R. Berlekamp, J. H. Conway, and R. K. Guy, Winning Ways For Your Mathematical Plays, Vol. 1, CRC Press, 2001.

Crossrefs

Programs

  • Python
    import math
    bn = [1,1,1]
    wn = [0,0,0]
    kn = [1,1,1]
    def summation(n):
        final = bn[n] - bn[n-1]
        for k in range(4,n+1):
            final -= wn[k-1]*bn[n-k]
        return final
    def smallsum(n):
        final = bn[n-1]
        for k in range(4,n+1):
            final += wn[k-1]*bn[n-k]
        return final
    def derrangement(n):
        finalsum = 0
        for i in range(n+1):
            if i%2 == 0:
                finalsum += math.factorial(n)*1//math.factorial(i)
            else:
                finalsum -= math.factorial(n)*1//math.factorial(i)
        if finalsum != 0:
            return finalsum
        else:
            return 1
    def fixedpoint(n):
        finalsum = math.factorial(n-1)
        for i in range(2,n):
            finalsum += math.factorial(i-i)*math.factorial(n-i-1)
            print(math.factorial(i-i)*math.factorial(n-i-1))
        return finalsum
    def no_cycles(n):
        goal = n
        cycles = [0, 1]
        current = 2
        while current<= goal:
            new = 0
            k = 1
            while k<=current:
                new += (math.factorial(k-1)-cycles[k-1])*(math.factorial(current-k))
                k+=1
            cycles.append(new)
            current+=1
        return cycles
    def total_func(n):
        for i in range(3,n+1):
            bn.append(derrangement(i+1)//(i))
            kn.append(smallsum(i))
            wn.append(summation(i))
        an = no_cycles(n)
        tl = [int(an[i]-kn[i]) for i in range(n+1)]
        factorial = [math.factorial(x) for x in range(0,n+1)]
        print("A346189 :" + str(wn[1:]))
        print("A346198 :" + str([factorial[i]-wn[i]-tl[i]-kn[i] for i in range(n+1)][1:]))
        print("A346199 :" + str(kn[1:]))
        print("A346204 :" + str(tl[1:]))
    total_func(20)

Formula

a(n) = A006932(n) - A346199(n).

A174662 Partial sums of A003149.

Original entry on oeis.org

1, 3, 8, 24, 88, 400, 2212, 14500, 110116, 951076, 9205156, 98646436, 1159016356, 14808626596, 204358994596, 3028436306596, 47955883346596, 807990334802596, 14430691329362596, 272302801683794596, 5412861968581970596
Offset: 0

Views

Author

Jonathan Vos Post, Nov 30 2010

Keywords

Comments

Total resistance of a circuit whose n-th component is between opposite corners of an n-dimensional hypercube of unit resistors, multiplied by n!. The only prime in the sequence is 3. The subsequence of squares begins 1, 400, 9205156 = 2^2 * 37^2 * 41^2.

Examples

			a(5) = 1 + 2 + 5 + 16 + 64 + 312 = 400 = 2^4 * 5^2.
		

Crossrefs

Formula

a(n) = Sum_{i=0..n} Sum_{k=0..i} k!*(i-k)!.

Extensions

Offset set to 0 by Alois P. Heinz, Jun 28 2017
Showing 1-5 of 5 results.