A102038 a(n+1) = n*a(n) + a(n-1), a(1)=1, a(2)=2.
1, 2, 5, 17, 73, 382, 2365, 16937, 137861, 1257686, 12714721, 141119617, 1706150125, 22321071242, 314201147513, 4735338283937, 76079613690505, 1298088771022522, 23441677492095901, 446689961120844641
Offset: 1
Links
- G. C. Greubel, Table of n, a(n) for n = 1..449
- Juan S. Auli and Sergi Elizalde, Wilf equivalences between vincular patterns in inversion sequences, arXiv:2003.11533 [math.CO], 2020.
- Zhicong Lin and Sherry H. F. Yan, Vincular patterns in inversion sequences, Applied Mathematics and Computation (2020), Vol. 364, 124672.
- Shuzhen Lv and Philip B. Zhang, Joint equidistributions of mesh patterns 123 and 321 with symmetric and antipodal shadings, arXiv:2501.00357 [math.CO], 2024. See p. 17.
Programs
-
GAP
a:=[1,2];; for n in [3..30] do a[n]:=(n-1)*a[n-1]+a[n-2]; od; a; # G. C. Greubel, Feb 23 2019
-
Magma
I:=[1,2]; [n le 2 select I[n] else (n-1)*Self(n-1) +Self(n-2): n in [1..30]]; // G. C. Greubel, Feb 23 2019
-
Mathematica
a[1]= 1; a[2]= 2; a[n_]:= a[n] = (n-1)*a[n-1]+a[n-2]; Table[a[n], {n,20}] (* Robert G. Wilson v, Feb 14 2005 *) RecurrenceTable[{a[1]==1,a[2]==2,a[n+1]==n*a[n]+a[n-1]},a,{n,20}] (* Harvey P. Dale, Sep 04 2018 *)
-
PARI
a(n)=sum(k=0,n,k!*binomial((n+k)\2,k)*binomial((n+k+1)\2,k)) \\ Paul D. Hanna, Oct 31 2006
-
Sage
[sum(factorial(k)*binomial(floor((n+k-1)/2), k)*binomial(floor((n+k)/2), k) for k in (0..n)) for n in (1..30)] # G. C. Greubel, Feb 23 2019
Formula
From Paul D. Hanna, Oct 31 2006: (Start)
a(n+1) = Sum_{k=0..n} k!*C(floor((n+k)/2),k)*C(floor((n+k+1)/2),k).
a(n+1) = Sum_{k=0..n} k!*A124428(n+k,k). (End)
Extensions
Edited and extended by Robert G. Wilson v, Feb 14 2005
Comments