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!)
A105931 a(1) = 1 then a(n) = a(n-1) - (-1)^ceiling(n/2)*a(floor(n/2)). 1
1, 2, 1, -1, 1, 2, 1, 2, 1, 2, 1, -1, 1, 2, 1, -1, 1, 2, 1, -1, 1, 2, 1, 2, 1, 2, 1, -1, 1, 2, 1, 2, 1, 2, 1, -1, 1, 2, 1, 2, 1, 2, 1, -1, 1, 2, 1, -1, 1, 2, 1, -1, 1, 2, 1, 2, 1, 2, 1, -1, 1, 2, 1, -1, 1, 2, 1, -1, 1, 2, 1, 2, 1, 2, 1, -1, 1, 2, 1, -1, 1, 2, 1, -1, 1, 2, 1, 2, 1, 2, 1, -1, 1, 2, 1, 2, 1, 2, 1, -1, 1, 2, 1, 2, 1, 2, 1, -1, 1, 2, 1, -1, 1, 2, 1, -1, 1, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
The asymptotic density of the occurrences of -1, 1, and 2 are 1/6, 1/2, and 1/3, respectively. - Amiram Eldar, Nov 30 2022
LINKS
FORMULA
abs(a(n)) = A056832(n).
a(k) = -1 iff k is in 4*A003159.
From Amiram Eldar, Nov 30 2022: (Start)
Multiplicative with a(2^e) = 2 if e is odd and -1 if e is even, and a(p^e) = 1 for p > 2.
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1. (End)
Dirichlet g.f.: zeta(s)*(4^s+2^(s+1)-2)/(4^s+2^s). - Amiram Eldar, Jan 04 2023
MATHEMATICA
a[n_] := Module[{e = IntegerExponent[n, 2]}, If[e > 0, If[Mod[e, 2] == 1, 2, -1], 1]]; Array[a, 100] (* Amiram Eldar, Nov 30 2022 after the second PARI code *)
PROG
(PARI) a(n)=if(n<2, 1, a(n-1)-(-1)^ceil(n/2)*a(floor(n/2)))
(PARI) a(n)={my(e=valuation(n, 2)); if(e>0, if(e%2, 2, -1), 1)} \\ Andrew Howroyd, Aug 06 2018
CROSSREFS
Sequence in context: A342845 A045887 A056832 * A349163 A279495 A300409
KEYWORD
sign,mult
AUTHOR
Benoit Cloitre, Apr 26 2005
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 25 12:33 EDT 2024. Contains 371969 sequences. (Running on oeis4.)