A260321 Erroneous version of A094047.
-1, 0, 2, 12, 312, 9600, 410800, 23879520, 1749363840, 159591720960
Offset: 1
Keywords
Links
- H. M. Taylor, A problem on arrangements, Mess. Math., 32 (1902), 60ff. [Annotated scanned copy]
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.
a(2) = 0; nothing works. a(3) = 1; (201) works. a(4) = 2; (2301), (3012) work. a(5) = 13; (20413), (23401), (24013), (24103), (30412), (30421), (34012), (34021), (34102), (40123), (43012), (43021), (43102) work.
import Data.List (zipWith5) a000179 n = a000179_list !! n a000179_list = 1 : -1 : 0 : 1 : zipWith5 (\v w x y z -> (x * y + (v + 2) * z - w) `div` v) [2..] (cycle [4,-4]) (drop 4 a067998_list) (drop 3 a000179_list) (drop 2 a000179_list) -- Reinhard Zumkeller, Aug 26 2013
A000179:= n ->add ((-1)^k*(2*n)*binomial(2*n-k,k)*(n-k)!/(2*n-k), k=0..n); # for n >= 1 U:= proc(n) local k; add( (2*n/(2*n-k))*binomial(2*n-k,k)*(n-k)!*(x-1)^k, k=0..n); end; W := proc(r,s) coeff( U(r),x,s ); end; A000179 := n->W(n,0); # valid for n >= 1
a[n_] := 2*n*Sum[(-1)^k*Binomial[2*n - k, k]*(n - k)!/(2*n - k), {k, 0, n}]; a[0] = 1; Table[a[n], {n, 0, 21}] (* Jean-François Alcover, Dec 05 2012, from 2nd formula *)
\\ 3 programs adapted to a(1) = -1 by Hugo Pfoertner, Aug 31 2020
{a(n) = my(A); if( n, A = vector(n,i,i-2); for(k=4, n, A[k] = (k * (k - 2) * A[k-1] + k * A[k-2] - 4 * (-1)^k) / (k-2)); A[n], 1)};/* Michael Somos, Jan 22 2008 */
a(n)=if(n>1, round(2*n*exp(-2)*besselk(n, 2)), 1-2*n) \\ Charles R Greathouse IV, Nov 03 2014
{a(n) = my(A); if( n, A = vector(n,i,i-2); for(k=5, n, A[k] = k * A[k-1] + 2 * A[k-2] + (4-k) * A[k-3] - A[k-4]); A[n], 1)} /* Michael Somos, May 02 2018 */
from math import comb, factorial def A000179(n): return 1 if n == 0 else sum((-2*n if k & 1 else 2*n)*comb(m:=2*n-k,k)*factorial(n-k)//m for k in range(n+1)) # Chai Wah Wu, May 27 2022
a(3) = 12 because there is a unique seating arrangement up to circular and clockwise / counterclockwise symmetry. - _Paul C. Kainen_ and _Michael Somos_, Mar 11 2011
a[0] = 1; a[1] = 0; a[n_] := 4n n! Sum[(-1)^k Binomial[2n-k, k] (n-k)! / (2n-k), {k, 0, n}]; Table[a[n], {n, 0, 17}] (* Jean-François Alcover, Jun 19 2017, from 1st formula *)
{a(n) = local(A); if( n<3, n==0, A = vector(n); A[3] = 1; for(k=4, n, A[k] = (k * (k - 2) * A[k-1] + k * A[k-2] - 4 * (-1)^k) / (k-2)); 2 * n! * A[n])} /* Michael Somos, Mar 11 2011 */
a[1] = 0; a[n_] := n! Sum[(-1)^j (n-j)! SeriesCoefficient[ SeriesCoefficient[ Tr[ MatrixPower[{{0, 1, 0, y^2, 0, 0}, {z y^2, 0, 1, 0, y^2, 0}, {z y^2, 0, 0, 0, y^2, 0}, {0, 1, 0, 0, 0, z}, {0, 1, 0, y^2, 0, z}, {0, 0, 1, 0, y^2, 0}}, 2n]], {y, 0, 2n}], {z, 0, j}], {j, 0, n}]; Array[a, 16] (* Jean-François Alcover, Dec 03 2018, from 1st PARI program *)
{ a(n) = if(n<2, 0, n! * sum(j=0,n, (-1)^j * (n-j)! *polcoeff( polcoeff( trace([0, 1, 0, y^2, 0, 0; z*y^2, 0, 1, 0, y^2, 0; z*y^2, 0, 0, 0, y^2, 0; 0, 1, 0, 0, 0, z; 0, 1, 0, y^2, 0, z; 0, 0, 1, 0, y^2, 0]^(2*n)), 2*n,y) ,j,z)) ); }
{ a(n) = if(n<2, 0, n! * polcoeff( serlaplace( polcoeff( trace([-y, z*y, z, 0, z*y, -y; -y, (z - 1)*y, 0, (z - 1)*y^2, z*y, -y; 0, (z - 1)*y, 0, (z - 1)*y^2, 0, -y; -y, 0, z - 1, 0, (z - 1)*y, 0; -y, z*y, z - 1, 0, (z - 1)*y, -y; -y, z*y, 0, z*y^2, z*y, -y]^n), n, y) )/(1-z) + O(z^(n+1)), n, z) ) }
Table[2 n! Sum[(-1)^(n - k) k! Binomial[n + k, 2 k], {k, 0, n}], {n, 3, 20}] (* Eric W. Weisstein, Sep 20 2017 *) Table[2 (-1)^n n! HypergeometricPFQ[{1, -n, n + 1}, {1/2}, 1/4], {n, 3, 20}] (* Eric W. Weisstein, Sep 20 2017 *)
/* needs the routine nhp() from the Alekseyev link */ { A137886(n) = nhp( matrix(2*n,2*n,i,j, if(min(i,j)<=n && max(i,j)>n && abs(j-i)!=n, 1, 0)) ) }
a(1)=0 because two people always make eye contact when they look at each other. a(2)=30 because 4 people can look at each other in 30 distinct ways without making eye contact.
I:=[30, 156, 826, 4406]; [0] cat [n le 4 select I[n] else 8*Self(n-1) -16*Self(n-2) +10*Self(n-3) -Self(n-4): n in [1..30]]; // G. C. Greubel, Mar 31 2021
Join[{0}, LinearRecurrence[{8, -16, 10, -1}, {30, 156, 826, 4406}, 20]] (* Jean-François Alcover, Dec 14 2018 *)
def A141221_list(prec): P.= PowerSeriesRing(QQ, prec) return P( 2*x^2*(15 -42*x +29*x^2 -3*x^3)/((1-x)*(1-7*x+9*x^2-x^3)) ).list() a=A141221_list(30) print(a[1:]) # G. C. Greubel, Mar 31 2021
For d=1, the sequence a_{n} is the classical menage sequence A094047. For d=2 (the current sequence), the F(n)s are 0, 0, 0, 0, 1, 2, 31, 264, 2783, 30818, 369321, ... which is A004307(n) then the sequence a_{n} is 0, 0, 0, 0, 24, 240, 22320, 1330560, 112210560, 11183235840, 1340192044800,... For d=3, the F(n)s are 0, 0, 0, 0, 0, 0, 1, 2, 78, 888, 13909, ... which is A184965, and a(n) = (n-1)!*A184965(n).
b[n_, n0_] := Permanent[Table[If[(0 <= j - i && j - i < n - n0) || j - i < -n0, 1, 0], {i, 1, n}, {j, 1, n}]]; A004307[n_] := b[n, 4]; a[n_] := (n - 1)!*A004307[n]; Array[a, 18] (* Jean-François Alcover, Oct 08 2017 *)
Comments