login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A120691 First differences of coefficients in the continued fraction for e. 4
2, -1, 1, -1, 0, 3, -3, 0, 5, -5, 0, 7, -7, 0, 9, -9, 0, 11, -11, 0, 13, -13, 0, 15, -15, 0, 17, -17, 0, 19, -19, 0, 21, -21, 0, 23, -23, 0, 25, -25, 0, 27, -27, 0, 29, -29, 0, 31, -31, 0, 33, -33, 0, 35, -35, 0, 37, -37, 0, 39, -39 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
COMMENTS
First differences of A003417.
LINKS
FORMULA
G.f.: (1-x)*(2+x+2*x^2-3*x^3-x^4+x^6)/(1-2*x^3+x^6).
a(n) = 2*C(0,n) -C(1,n) +2*sin(2*Pi*(n-1)/3)*floor((2*n-1)/3)/sqrt(3). [Sign corrected by M. F. Hasler, May 01 2013]
a(0)=2, a(1)=-1, for n>0: a(3*n-1) = 2*n-1, a(3*n) = 1-2*n, a(3*n+1) = 0. - M. F. Hasler, May 01 2013
a(n) = - a(n-1) - a(n-2) + a(n-3) + a(n-4) + a(n-5) for n > 6. - Chai Wah Wu, Jul 27 2022
a(n) = 0 if n mod 3 = 1, a(n) = (2*n-1)/3 if n mod 3 = 2, a(n) = (3-2*n)/3 otherwise, with a(0) = 2, and a(1) = -1. - G. C. Greubel, Dec 28 2022
MATHEMATICA
Join[{2}, Differences[ContinuedFraction[E, 120]]] (* or *) LinearRecurrence[{-1, -1, 1, 1, 1}, {2, -1, 1, -1, 0, 3, -3}, 120] (* Harvey P. Dale, Jun 08 2016 *)
PROG
(PARI) A120691(n)={n<2 && return(2-3*n); n=divrem(n-1, 3); if(n[2], -(1+n[1]*2)*(-1)^n[2])} \\ - M. F. Hasler, May 01 2013
(Magma) R<x>:=PowerSeriesRing(Integers(), 70); Coefficients(R!( (1-x)*(2+x+2*x^2-3*x^3-x^4+x^6)/(1-x^3)^2 )); // G. C. Greubel, Dec 28 2022
(SageMath)
def b(n):
if (n%3==1): return 0
elif (n%3==2): return (2*n-1)/3
else: return (3-2*n)/3
def A120691(n): return b(n) + (-1)^n*int(n<2)
[A120691(n) for n in range(71)] # G. C. Greubel, Dec 28 2022
CROSSREFS
Sequence in context: A182662 A308778 A127284 * A111941 A153462 A126310
KEYWORD
easy,sign
AUTHOR
Paul Barry, Jun 27 2006
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 16:25 EDT 2024. Contains 371961 sequences. (Running on oeis4.)