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
A053983
a(n) = (2*n-1)*a(n-1) - a(n-2), a(0)=a(1)=1.
Original entry on oeis.org
1, 1, 2, 9, 61, 540, 5879, 75887, 1132426, 19175355, 363199319, 7608010344, 174621038593, 4357917954481, 117489163732394, 3402827830284945, 105370173575100901, 3473812900148044788, 121478081331606466679, 4491215196369291222335, 175035914577070751204386
Offset: 0
a(10) = 363199319 because 1/(1-1/(3-1/(5-1/(7-1/(9-1/(11-1/(13-1/(15-1/(17-1/19))))))))) = 565649425/363199319.
-
[1] cat [ n le 2 select n else (2*n-1)*Self(n-1)-Self(n-2): n in [1..25] ]; // Vincenzo Librandi, Mar 08 2015
-
E(x):=sin(1)*cos(sqrt(1-2*x))-cos(1)*sin(sqrt(1-2*x)): f[0]:=E(x): for n from 1 to 30 do f[n]:=diff(f[n-1],x) od: x:=0: for n from 1 to 30 do f[n]:=simplify(f[n]/(sin(1)^2+cos(1)^2)) od: seq(f[n],n=1..30); # Miklos Kristof, Jun 15 2005
-
RecurrenceTable[{a[0]==a[1]==1,a[n]==(2n-1)a[n-1]-a[n-2]},a,{n,20}] (* Harvey P. Dale, Dec 21 2011 *)
CoefficientList[Series[Cos[1-Sqrt[1-2*x]]/Sqrt[1-2*x], {x, 0, 20}], x] * Range[0, 20]! (* Vaclav Kotesovec, Jul 31 2014 *)
-
a(n)={if(n<2,1,(2*n-1)*a(n-1)-a(n-2))} \\ Edward Jiang, Sep 10 2014
-
{a(n) = my(a0, a1, s=n<0); if( n>-3 && n<1, return(n+1)); if( n<0, n=-1-n); a0=1-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 A053983(n):
if n < 2: return 1
return 2^n*gamma(n+1/2)*hypergeometric([1/2-n/2, -n/2], [1/2, 1/2-n, -n], -1)/sqrt(pi)
[round(A053983(n).n(100)) for n in (0..20)] # Peter Luschny, Sep 10 2014
A121323
a(n) = (2*n+1)*a(n-1) - a(n-2) starting a(0)=0, a(1)=1.
Original entry on oeis.org
0, 1, 5, 34, 301, 3277, 42300, 631223, 10688491, 202450106, 4240763735, 97335115799, 2429137131240, 65489367427681, 1896762518271509, 58734148698989098, 1936330144548368725, 67712820910493916277, 2503438043543726533524, 97566370877294840891159
Offset: 0
-
A121323 := proc(n)
BesselJ(3/2+n,1)*BesselY(3/2,1)-BesselJ(3/2,1)*BesselY(3/2+n,1) ;
simplify(Pi*%/2 );
end proc: # R. J. Mathar, Oct 13 2012
-
f[n_Integer] = Module[{a}, a[n] /. RSolve[{a[n] == (2*n + 1)*a[n - 1] - a[n - 2], a[0] == 0, a[1] == 1}, a[n], n][[1]] // FullSimplify] Rationalize[N[Table[f[n], {n, 0, 25}], 100], 0]
CoefficientList[Series[((Sqrt[1-2*x]+1)*Sin[1-Sqrt[1-2*x]]+(Sqrt[1-2*x]-1)*Cos[1-Sqrt[1-2*x]])/(1-2*x)^(3/2),{x,0,20}],x]*Range[0,20]! (* Vaclav Kotesovec, Oct 21 2012 *)
nxt[{n_,a_,b_}]:={n+1,b,(2n+3)b-a}; NestList[nxt,{1,0,1},20][[All,2]] (* Harvey P. Dale, Sep 04 2021 *)
-
def A121323(n):
if n < 2: return n
return 2^(n+1)*gamma(n+3/2)*hypergeometric([1/2-n/2, 1-n/2], [5/2, -n-1/2, 1-n],-1) /(3*sqrt(pi))
[round(A121323(n).n(100)) for n in (0..19)] # Peter Luschny, Sep 10 2014
A121353
a(n) = (3*n - 2)*a(n-1) - a(n-2) starting a(0)=0, a(1)=1.
Original entry on oeis.org
0, 1, 4, 27, 266, 3431, 54630, 1034539, 22705228, 566596161, 15841987280, 490535009519, 16662348336366, 616016353436023, 24623991789104554, 1058215630578059799, 48653295014801646200, 2382953240094702604001, 123864915189909733761852, 6810187382204940654297859
Offset: 0
-
f[n_Integer] = Module[{a}, a[n] /. RSolve[{a[n] == (3*n - 2)*a[n - 1] - a[n - 2], a[0] == 0, a[1] == 1}, a[n], n][[1]] // FullSimplify] Rationalize[N[Table[f[n], {n, 0, 25}], 100], 0]
RecurrenceTable[{a[0]==0, a[1]==1, a[n]==(3n-2)*a[n-1]-a[n-2]}, a, {n, 20}] (* Vaclav Kotesovec, Jul 31 2014 *)
nxt[{n_,a_,b_}]:={n+1,b,b(3n+1)-a}; NestList[nxt,{1,0,1},20][[;;,2]] (* Harvey P. Dale, Jun 03 2023 *)
-
def A121353(n):
if n < 2: return n
return 3^n*gamma(n+1/3)*hypergeometric([1/2-n/2,1-n/2], [4/3, 2/3 -n, 1-n], -4/9)/gamma(1/3)
[round(A121353(n).n(100)) for n in (0..19)] # Peter Luschny, Sep 10 2014
A121351
a(n) = (3*n+1)*a(n-1) - a(n-2), starting a(0)=0, a(1)=1.
Original entry on oeis.org
0, 1, 7, 69, 890, 14171, 268359, 5889727, 146974816, 4109405121, 127244583935, 4322206448669, 159794394016818, 6387453554224051, 274500708437617375, 12620645134576175199, 618137110885794967376, 32130509120926762128353
Offset: 0
-
f[n_Integer] = Module[{a}, a[n] /. RSolve[{a[n] == (3*n + 1)*a[n - 1] - a[n - 2], a[0] == 0, a[1] == 1}, a[n], n][[1]] // FullSimplify] Rationalize[N[Table[f[n], {n, 0, 25}], 100], 0]
RecurrenceTable[{a[0]==0, a[1]==1, a[n]==(3n+1)*a[n-1]-a[n-2]}, a, {n, 20}] (* Vaclav Kotesovec, Jul 31 2014 *)
nxt[{n_,a_,b_}]:={n+1,b,(3n+4)b-a}; NestList[nxt,{1,0,1},20][[All,2]] (* Harvey P. Dale, Jun 20 2021 *)
A121354
a(n) = (3*n-1)*a(n-1) - a(n-2).
Original entry on oeis.org
0, 1, 5, 39, 424, 5897, 99825, 1990603, 45684044, 1185794541, 34342357645, 1097769650099, 38387595395820, 1457630855391061, 59724477475637681, 2626419378072666903, 123381986291939706760, 6166472895218912671097, 326699681460310431861381, 18289015688882165271566239
Offset: 0
-
f[n_Integer] = Module[{a}, a[n] /. RSolve[{a[n] == (3*n - 1)*a[n - 1] - a[n - 2], a[0] == 0, a[1] == 1}, a[n], n][[1]] // FullSimplify] Rationalize[N[Table[f[n], {n, 0, 25}], 100], 0]
RecurrenceTable[{a[0]==0,a[1]==1,a[n]==(3n-1)a[n-1]-a[n-2]},a,{n,20}] (* Harvey P. Dale, Jul 29 2014 *)
-
from sympy import cacheit
@cacheit
def A121354(n):
if n <= 1:
return n
else:
return (3*n-1)*A121354(n-1)-A121354(n-2)
print([A121354(n) for n in range(20)]) # Oct 14 2009
-
def A121354(n):
if n < 2: return n
return 3^(n-1)*gamma(n+2/3)*hypergeometric([1/2-n/2, 1-n/2], [5/3, 1/3-n, 1-n], -4/9) /gamma(5/3)
[round(A121354(n).n(100)) for n in (0..19)] # Peter Luschny, Sep 10 2014
Offset corrected by the Associate Editors of the OEIS - Oct 14 2009
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)]
Showing 1-10 of 12 results.
Comments