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

%I

%S 0,1,-1,3,5,-1,-7,13,3,5,7,3,17,-5,-31,45,39,-23,-33,51,37,-17,-23,45,

%T 11,13,23,3,65,-37,-127,157,79,-47,-1,35,101,-65,-167,205,131,-91,-57,

%U 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

%N 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).

%H Altug Alkan, <a href="/A318190/b318190.txt">Table of n, a(n) for n = 0..10000</a>

%H Altug Alkan, <a href="/A318190/a318190.png">A scatterplot of a(n) for n <= 10^5</a>

%F 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

%p f:= proc(n) option remember;

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

%p else n-1-procname(n-1)

%p fi

%p end proc:

%p f(0):= 0: f(1):= 1:

%p map(f, [$0..100]); # _Robert Israel_, Aug 28 2018

%t 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 *)

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

%o (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]))", "));

%o (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

%Y Cf. A002487, A303404.

%K sign,easy,look

%O 0,4

%A _Altug Alkan_, Aug 20 2018

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 September 18 17:45 EDT 2019. Contains 327178 sequences. (Running on oeis4.)