login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A318190 a(0) = 0, a(1) = 1; for n >= 1, a(2*n) = a(2*n-1) - 2*a(n), a(2*n+1) = 2*n - a(2*n). 2
0, 1, -1, 3, 5, -1, -7, 13, 3, 5, 7, 3, 17, -5, -31, 45, 39, -23, -33, 51, 37, -17, -23, 45, 11, 13, 23, 3, 65, -37, -127, 157, 79, -47, -1, 35, 101, -65, -167, 205, 131, -91, -57, 99, 145, -101, -191, 237, 215, -167, -193, 243, 197, -145, -151, 205, 75, -19, 55, 3, 257, -197, -511, 573, 415, -351, -257, 323, 325 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,4

LINKS

Altug Alkan, Table of n, a(n) for n = 0..10000

Altug Alkan, A scatterplot of a(n) for n <= 10^5

FORMULA

G.f. g(x) satisfies g(x) = (x+x^5)/(1-x^2)^2 - x*g(-x) - 2*g(x^2). - Robert Israel, Aug 28 2018

MAPLE

f:= proc(n) option remember;

  if n::even then procname(n-1) - 2*procname(n/2)

  else n-1-procname(n-1)

  fi

end proc:

f(0):= 0: f(1):= 1:

map(f, [$0..100]); # Robert Israel, Aug 28 2018

MATHEMATICA

a[0]=0; a[1]=1; a[n_] := a[n] = If[EvenQ[n], a[n-1] - 2 a[n/2], n-1 - a[n - 1]]; Array[a, 70, 0] (* Giovanni Resta, Aug 27 2018 *)

PROG

(PARI) a(n)=if(n<=1, n, if(n%2==0, a(n-1)-2*a(n/2), n-1-a(n-1)));

(PARI) a = vector(99); print1 (0", "); for(n=1, #a, print1 (a[n]=if(n==1, 1, if(n%2, n-1-a[n-1], a[n-1]-2*a[n/2]))", "));

(MAGMA) [0] cat [n eq 1 select 1 else n mod 2 eq 0 select Self(n-1)-2*Self(n div 2) else n-1 - Self(n-1): n in [1..70]]; // Vincenzo Librandi, Aug 28 2018

CROSSREFS

Cf. A002487, A303404.

Sequence in context: A114216 A208509 A086233 * A289714 A242390 A065395

Adjacent sequences:  A318187 A318188 A318189 * A318191 A318192 A318193

KEYWORD

sign,easy,look

AUTHOR

Altug Alkan, Aug 20 2018

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 20 03:33 EDT 2019. Contains 326139 sequences. (Running on oeis4.)