(Translated by https://www.hiragana.jp/)
A009001 - OEIS
login
A009001
Expansion of e.g.f: (1+x)*cos(x).
6
1, 1, -1, -3, 1, 5, -1, -7, 1, 9, -1, -11, 1, 13, -1, -15, 1, 17, -1, -19, 1, 21, -1, -23, 1, 25, -1, -27, 1, 29, -1, -31, 1, 33, -1, -35, 1, 37, -1, -39, 1, 41, -1, -43, 1, 45, -1, -47, 1, 49, -1, -51, 1, 53, -1, -55, 1, 57, -1, -59, 1, 61, -1, -63, 1, 65, -1, -67, 1, 69, -1, -71, 1, 73, -1, -75, 1, 77, -1, -79, 1, 81, -1, -83, 1, 85
OFFSET
0,4
COMMENTS
If signs are ignored, continued fraction for tan(1) (cf. A093178).
FORMULA
a(n) = (-1)^(n/2) if n is even, n*(-1)^((n-1)/2) if n is odd.
a(n) = -a(n-2) if n is even, 2*a(n-1) - a(n-2) if n is odd. - Michael Somos, Jan 26 2014
From Henry Bottomley, Oct 19 2001: (Start)
a(n) = (n^n mod (n+1))*(-1)^floor(n/2) for n > 0.
a(n) = (-1)^n*(a(n-2) - a(n-1)) - a(n-3) for n > 2. (End)
G.f.: (1+x+x^2-x^3)/(1+x^2)^2.
E.g.f.: (1+x)*cos(x) = U(0) where U(k) = 1 + x - x^2/((2*k+1)*(2*k+2)) * U(k+1). - Sergei N. Gladkovskii, Oct 17 2012 [Edited by Michael Somos, Jan 26 2014]
From James C. McMahon, Oct 12 2023: (Start)
a(0) = 1; for n > 1,
a(n) = a(n-1) * n if n mod 4 = 1,
a(n-1) - n if n mod 4 = 2,
a(n-1) * n if n mod 4 = 3,
a(n-1) + n if n mod 4 = 4. (End)
EXAMPLE
tan(1) = 1.557407724654902230... = 1 + 1/(1 + 1/(1 + 1/(3 + 1/(1 + ...)))). - Harry J. Smith, Jun 15 2009
G.f. = 1 + x - x^2 - 3*x^3 + x^4 + 5*x^5 - x^6 - 7*x^7 + x^8 + 9*x^9 - x^10 + ...
MAPLE
seq(coeff(series(factorial(n)*(1+x)*cos(x), x, n+1), x, n), n=0..90); # Muniru A Asiru, Jul 21 2018
MATHEMATICA
With[{nn=90}, CoefficientList[Series[(1+x)Cos[x], {x, 0, nn}], x]Range[0, nn]!] (* Harvey P. Dale, Jul 15 2012 *)
LinearRecurrence[{0, -2, 0, -1}, {1, 1, -1, -3}, 100] (* Jean-François Alcover, Feb 21 2020 *)
FoldList[If[Mod[#2, 4]==1, #1*#2, If[Mod[#2, 4]==2, #1-#2, If[Mod[#2, 4] ==3, #1*#2, #1+#2]]]&, 1, Range[1, 85]] (* James C. McMahon, Oct 12 2023 *)
PROG
(PARI) {a(n) = (-1)^(n\2) * if( n%2, n, 1)} /* Michael Somos, Oct 16 2006 */
(PARI) { allocatemem(932245000); default(realprecision, 79000); x=contfrac(tan(1)); for (n=0, 20000, write("b009001.txt", n, " ", (-1)^(n\2)*x[n+1])); } \\ Harry J. Smith, Jun 15 2009
(Magma) m:=50; R<x>:=PowerSeriesRing(Rationals(), m); b:=Coefficients(R!((1+x)*Cos(x))); [Factorial(n-1)*b[n]: n in [1..m]]; // G. C. Greubel, Jul 21 2018
CROSSREFS
Cf. A009531, A049471 (decimal expansion of tan(1)).
Sequence in context: A274660 A327531 A327514 * A093178 A340086 A307153
KEYWORD
sign,easy,nice
EXTENSIONS
Formula corrected by Olivier Gérard, Mar 15 1997
Definition clarified by Harvey P. Dale, Jul 15 2012
STATUS
approved