OFFSET
0,4
COMMENTS
Continued fraction expansion for tan(1).
1 followed by run lengths of A062557 = 2n-1 1's followed by a 2. - Jeremy Gardiner, Aug 12 2012
Greatest common divisor of n and (n+1) mod 2. - Bruno Berselli, Mar 07 2017
LINKS
Harry J. Smith, Table of n, a(n) for n = 0..20000
D. H. Lehmer, Continued fractions containing arithmetic progressions, Scripta Mathematica, 29 (1973): 17-24. [Annotated copy of offprint]
Simon Plouffe, A Search for a mathematical expression for mass ratios using a large database. page 3.
G. Xiao, Contfrac
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
FORMULA
G.f.: (1+x-x^2+x^3)/(1-x^2)^2.
a(n) = (-1)^n * a(-n) for all n in Z.
a(n) = (1/2) * [ 1 + n + (1-n)*(-1)^n ]. - Ralf Stephan, Dec 02 2004
a(n) = n^n mod (n+1) for n > 0. - Amarnath Murthy, Apr 18 2004
Satisfies a(0) = 1, a(n+1) = a(n) + n if a(n) < n else a(n+1) = a(n)/n. - Amarnath Murthy, Oct 29 2002
a(n) = ((n+1)+(1-n)(-1)^n)/2 and have e.g.f. (1+x)cosh(x). - Paul Barry, Apr 09 2003
a(n) = binomial(n, 2*floor(n/2)). - Paul Barry, Dec 28 2006
Starting (1, 1, 3, 1, 5, 1, 7, ...) = A133080^(-1) * [1,2,3,...]. - Gary W. Adamson, Sep 08 2007
a(n) = denom(b(n+2)/b(n+1)) with b(n) = product((2*n-3-2*k), k=0..floor(n/2-1)). - Johannes W. Meijer, Jun 18 2009
a(n) = 2*floor(n/2) - n*(n-1 mod 2) + 1. - Wesley Ivan Hurt, Oct 19 2013
a(n) = n^(n mod 2). - Wesley Ivan Hurt, Apr 16 2014
EXAMPLE
1.557407724654902230506974807... = 1 + 1/(1 + 1/(1 + 1/(3 + 1/(1 + ...))))
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
MATHEMATICA
Join[{1}, Riffle[Range[1, 85, 2], 1]] (* or *) Array[If[EvenQ[#], 1, #]&, 87, 0] (* Harvey P. Dale, Nov 23 2011 *)
PROG
(PARI) {a(n) = if( n%2, n, 1)};
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Michael Somos, Mar 27 2004
STATUS
approved