A058798
a(n) = n*a(n-1) - a(n-2) with a(0) = 0, a(1) = 1.
Original entry on oeis.org
0, 1, 2, 5, 18, 85, 492, 3359, 26380, 234061, 2314230, 25222469, 300355398, 3879397705, 54011212472, 806288789375, 12846609417528, 217586071308601, 3903702674137290, 73952764737299909, 1475151592071860890
Offset: 0
Continued fraction approximation 1/(1-1/(2-1/(3-1/4))) = 18/7 = a(4)/A058797(4). - _Wolfdieter Lang_, Mar 08 2013
Other recurrences of this type:
A001040,
A036242,
A036244,
A053983,
A053984,
A053987,
A058307,
A058308,
A058309,
A058797,
A058799,
A075374,
A106174,
A121323,
A121351,
A121353,
A121354,
A222468,
A222470.
-
a:=[1,2];; for n in [3..25] do a[n]:=n*a[n-1]-a[n-2]; od; Concatenation([0], a); # Muniru A Asiru, Oct 26 2018
-
[0] cat [n le 2 select n else n*Self(n-1)-Self(n-2): n in [1..30]]; // Vincenzo Librandi, Sep 22 2016
-
t = {0, 1}; Do[AppendTo[t, n*t[[-1]] - t[[-2]]], {n, 2, 25}]; t (* T. D. Noe, Oct 12 2012 *)
nxt[{n_,a_,b_}]:={n+1,b,b*(n+1)-a}; Transpose[NestList[nxt,{1,0,1},20]] [[2]] (* Harvey P. Dale, Nov 30 2015 *)
-
m=30; v=concat([1,2], vector(m-2)); for(n=3, m, v[n] = n*v[n-1]-v[n-2]); concat(0, v) \\ G. C. Greubel, Nov 24 2018
-
def A058798(n):
if n < 3: return n
return hypergeometric([1/2-n/2, 1-n/2],[2, 1-n, -n], -4)*factorial(n)
[simplify(A058798(n)) for n in (0..20)] # Peter Luschny, Sep 10 2014
A007060
Number of ways n married couples can sit in a row without any spouses next to each other.
Original entry on oeis.org
1, 0, 8, 240, 13824, 1263360, 168422400, 30865121280, 7445355724800, 2287168006717440, 871804170613555200, 403779880746418176000, 223346806774106790297600, 145427383048755178635264000, 110105698060190464791596236800, 95914116314126658718742347776000, 95252504853751428295192341381120000
Offset: 0
David Roberts Keeney (David.Roberts.Keeney(AT)directory.Reed.edu)
For n = 2, the a(2) = 8 solutions for the couples {1,2} and {3,4} are {1324, 1423, 2314, 2413, 3142, 3241, 4132, 4231}.
-
seq(add((-1)^i*binomial(n, i)*2^i*(2*n-i)!, i=0..n),n=0..20);
-
Table[Sum[(-1)^i Binomial[n,i] (2 n - i)! 2^i, {i, 0, n}], {n, 0, 20}]
Table[(2 n)! Hypergeometric1F1[-n, -2 n, -2], {n, 0, 20}]
-
a(n)=sum(k=0, n, binomial(n, k)*(-1)^(n-k)*(n+k)!*2^(n-k)) \\ Charles R Greathouse IV, May 11 2016
-
from sympy import binomial, subfactorial
def a(n): return sum([(-1)**(n - k)*binomial(n, k)*subfactorial(2*k) for k in range(n + 1)]) # Indranil Ghosh, Apr 28 2017
A053984
a(n) = (2*n-1)*a(n-1) - a(n-2), a(0) = 0, a(1) = 1.
Original entry on oeis.org
0, 1, 3, 14, 95, 841, 9156, 118187, 1763649, 29863846, 565649425, 11848774079, 271956154392, 6787055085721, 182978531160075, 5299590348556454, 164104322274089999, 5410143044696413513, 189190902242100382956, 6994653239913017755859, 272602285454365592095545
Offset: 0
a(10)=565649425 because 1/(1-1/(3-1/(5-1/(7-1/(9-1/(11-1/(13-1/(15-1/(17-1/19))))))))) = 565649425/363199319.
-
[n le 2 select (n-1) else (2*n-3)*Self(n-1)-Self(n-2): n in [1..25] ]; // Vincenzo Librandi, May 12 2015
-
f:= gfun:-rectoproc({a(n)=(2*n-1)*a(n-1)-a(n-2),a(0)=0,a(1)=1},a(n),remember):
map(f, [$0..30]); # Robert Israel, May 14 2015
-
CoefficientList[Series[Sin[1-Sqrt[1-2*x]]/Sqrt[1-2*x], {x, 0, 20}], x]* Range[0, 20]! (* Vaclav Kotesovec, Oct 05 2013 *)
RecurrenceTable[{a[n] == (2*n - 1)*a[n - 1] - a[n - 2], a[0] == 0,
a[1] == 1}, a, {n, 0, 50}] (* G. C. Greubel, Jan 22 2017 *)
-
a(n)={if(n<2,n,(2*n-1)*a(n-1)-a(n-2))} \\ Edward Jiang, Sep 10 2014
-
{a(n) = my(a0, a1, s=n<0); if( abs(n) < 2, return(n)); if( n<0, n=-1-n); a0=s; a1=1; for(k=2, n, a2 = (2*k-1)*a1 - a0; a0=a1; a1=a2); (-1)^(s*n) * a1}; /* Michael Somos, Sep 11 2014 */
-
def A053984(n):
if n < 2: return n
return 2^n*gamma(n+1/2)*hypergeometric([1-n/2, 1/2-n/2],[3/2, 1 - n, 1/2 -n], -1) / sqrt(pi)
[round(A053984(n).n(100)) for n in (0..20)] # Peter Luschny, Sep 10 2014
A177840
Consider the n pairs (1,2), ..., (2n-1,2n); a(n) is the number of permutations of [ 2n ] with no two fixed points for any pair.
Original entry on oeis.org
1, 1, 21, 653, 37577, 3434169, 457819549, 83900098309, 20238575173137, 6217167231292913, 2369809434953636261, 1097587512530348834301, 607119566298408076479961, 395312612701784187384578473, 299298318246814086742418737197, 260721599469397754183307347278709
Offset: 0
a(2) = 21, because there are 4! = 24 permutations of [ 4 ], only 3 of them have pairs with 2 fixed points: [1,2,3,4], [1,2,4,3], [2,1,3,4].
a(3) = A(3,0) = 653, A(3,1) = 63, A(3,2) = 3, A(3,4) = 1, sum = 720 = 6!.
-
f:= proc(n) option remember;
`if`(n<2, 1-n, (n-1) *(f(n-1)+f(n-2)))
end:
a:= n-> add(binomial(n,j) *2^j *f(2*n-j), j=0..n):
seq(a(n), n=0..20); # Alois P. Heinz, Sep 06 2011
-
f[n_] := f[n] = If[n<2, 1-n, (n-1)*(f[n-1]+f[n-2])]; a[n_] := Sum[Binomial[ n, j]*2^j*f[2*n-j], {j, 0, n}]; Table[a[n], {n, 1, 20}] (* Jean-François Alcover, Feb 25 2017, after Alois P. Heinz *)
A334823
Triangle, read by rows, of Lambert's denominator polynomials related to convergents of tan(x).
Original entry on oeis.org
1, 1, 0, 3, 0, -1, 15, 0, -6, 0, 105, 0, -45, 0, 1, 945, 0, -420, 0, 15, 0, 10395, 0, -4725, 0, 210, 0, -1, 135135, 0, -62370, 0, 3150, 0, -28, 0, 2027025, 0, -945945, 0, 51975, 0, -630, 0, 1, 34459425, 0, -16216200, 0, 945945, 0, -13860, 0, 45, 0, 654729075, 0, -310134825, 0, 18918900, 0, -315315, 0, 1485, 0, -1
Offset: 0
Polynomials:
f(0, x) = 1;
f(1, x) = x;
f(2, x) = 3*x^2 - 1;
f(3, x) = 15*x^3 - 6*x;
f(4, x) = 105*x^4 - 45*x^2 + 1;
f(5, x) = 945*x^5 - 420*x^3 + 15*x;
f(6, x) = 10395*x^6 - 4725*x^4 + 210*x^2 - 1;
f(7, x) = 135135*x^7 - 62370*x^5 + 3150*x^3 - 28*x;
f(8, x) = 2027025*x^8 - 945945*x^6 + 51975*x^4 - 630*x^2 + 1.
Triangle of coefficients begins as:
1;
1, 0;
3, 0, -1;
15, 0, -6, 0;
105, 0, -45, 0, 1;
945, 0, -420, 0, 15, 0;
10395, 0, -4725, 0, 210, 0, -1;
135135, 0, -62370, 0, 3150, 0, -28, 0;
2027025, 0, -945945, 0, 51975, 0, -630, 0, 1.
-
C := ComplexField();
T:= func< n, k| Round( i^k*Factorial(2*n-k)*(1+(-1)^k)/(2^(n-k+1)*Factorial(k)*Factorial(n-k)) ) >;
[T(n,k): k in [0..n], n in [0..10]];
-
T:= (n, k) -> I^k*(2*n-k)!*(1+(-1)^k)/(2^(n-k+1)*(k)!*(n-k)!);
seq(seq(T(n, k), k = 0 .. n), n = 0 .. 10);
-
(* First program *)
y[n_, x_]:= Sqrt[2/(Pi*x)]*E^(1/x)*BesselK[-n -1/2, 1/x];
f[n_, k_]:= Coefficient[((-I)^n/2)*(y[n, I*x] + (-1)^n*y[n, -I*x]), x, k];
Table[f[n, k], {n,0,10}, {k,n,0,-1}]//Flatten
(* Second program *)
Table[ I^k*(2*n-k)!*(1+(-1)^k)/(2^(n-k+1)*(k)!*(n-k)!), {n,0,10}, {k,0,n}]//Flatten
-
[[ i^k*factorial(2*n-k)*(1+(-1)^k)/(2^(n-k+1)*factorial(k)*factorial(n-k)) for k in (0..n)] for n in (0..10)]
A334824
Triangle, read by rows, of Lambert's numerator polynomials related to convergents of tan(x).
Original entry on oeis.org
1, 3, 0, 15, 0, -1, 105, 0, -10, 0, 945, 0, -105, 0, 1, 10395, 0, -1260, 0, 21, 0, 135135, 0, -17325, 0, 378, 0, -1, 2027025, 0, -270270, 0, 6930, 0, -36, 0, 34459425, 0, -4729725, 0, 135135, 0, -990, 0, 1, 654729075, 0, -91891800, 0, 2837835, 0, -25740, 0, 55, 0, 13749310575, 0, -1964187225, 0, 64324260, 0, -675675, 0, 2145, 0, -1
Offset: 0
Polynomials:
g(0, x) = 1;
g(1, x) = 3*x;
g(2, x) = 15*x^2 - 1;
g(3, x) = 105*x^3 - 10*x;
g(4, x) = 945*x^4 - 105*x^2 + 1;
g(5, x) = 10395*x^5 - 1260*x^3 + 21*x;
g(6, x) = 135135*x^6 - 17325*x^4 + 378*x^2 - 1;
g(7, x) = 2027025*x^7 - 270270*x^5 + 6930*x^3 - 36*x.
Triangle of coefficients begins as:
1;
3, 0;
15, 0, -1;
105, 0, -10, 0;
945, 0, -105, 0, 1;
10395, 0, -1260, 0, 21, 0;
135135, 0, -17325, 0, 378, 0, -1;
2027025, 0, -270270, 0, 6930, 0, -36, 0.
-
C := ComplexField();
T:= func< n, k| Round( i^k*Factorial(2*n-k+1)*(1+(-1)^k)/(2^(n-k+1)*Factorial(k+1)*Factorial(n-k)) ) >;
[T(n,k): k in [0..n], n in [0..10]];
-
T:= (n, k) -> I^k*(2*n-k+1)!*(1+(-1)^k)/(2^(n-k+1)*(k+1)!*(n-k)!);
seq(seq(T(n, k), k = 0..n), n = 0..10);
-
(* First program *)
y[n_, x_]:= Sqrt[2/(Pi*x)]*E^(1/x)*BesselK[-n -1/2, 1/x];
g[n_, k_]:= Coefficient[((-I)^n/2)*(y[n+1, I*x] + (-1)^n*y[n+1, -I*x]), x, k];
Table[g[n, k], {n,0,10}, {k,n,0,-1}]//Flatten
(* Second program *)
Table[I^k*(2*n-k+1)!*(1+(-1)^k)/(2^(n-k+1)*(k+1)!*(n-k)!), {n,0,10}, {k,0,n}]//Flatten
-
[[ i^k*factorial(2*n-k+1)*(1+(-1)^k)/(2^(n-k+1)*factorial(k+1)*factorial(n-k)) for k in (0..n)] for n in (0..10)]
A242227
a(n) = (2*n-1) * a(n-1) - a(n-2), a(0) = 1, a(1) = 2.
Original entry on oeis.org
1, 2, 5, 23, 156, 1381, 15035, 194074, 2896075, 49039201, 928848744, 19456784423, 446577192985, 11144973040202, 300467694892469, 8702418178841399, 269474495849190900, 8883955944844458301, 310668983573706849635, 11485868436282308978194
Offset: 0
G.f. = 1 + 2*x + 5*x^2 + 23*x^3 + 156*x^4 + 1381*x^5 + 15035*x^6 + ...
-
I:=[1,2]; [n le 2 select I[n] else (2*n-1)*Self(n-1) - Self(n-2): n in [1..30]]; // G. C. Greubel, Aug 06 2018
-
RecurrenceTable[{a[n] == (2*n-1)*a[n-1] - a[n-2], a[0] == 1, a[1] == 2}, a, {n, 0, 50}] (* G. C. Greubel, Aug 06 2018 *)
nxt[{n_,a_,b_}]:={n+1,b,b(2n+1)-a}; NestList[nxt,{1,1,2},20][[All,2]] (* Harvey P. Dale, Aug 01 2022 *)
-
{a(n) = if( n>-4, if( n<0, -2-n, (2*n - 1) * a(n-1) - a(n-2)), (2*n + 3) * a(n+1) - a(n+2))};
A257859
a(n) = (2*n-1)*a(n-1) - a(n-2) with a(0)=2, a(1)=1.
Original entry on oeis.org
2, 1, 1, 4, 27, 239, 2602, 33587, 501203, 8486864, 160749213, 3367246609, 77285922794, 1928780823241, 51999796304713, 1506065312013436, 46636024876111803, 1537482755599676063, 53765260421112550402, 1987777152825564688811, 77469543699775910313227
Offset: 0
-
[n le 2 select 3-n else (2*n-3)*Self(n-1)-Self(n-2): n in [1..50]]; // Vincenzo Librandi, May 12 2015
-
RecurrenceTable[{a[0] == 2, a[1] == 1, a[n] == -a[n - 2] + (2 n - 1) a[n - 1]}, a, {n, 30}]
Showing 1-8 of 8 results.
Comments