The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
The OEIS is supported by the many generous donors to the OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A068915 a(n) = n if n<2; a(n) = |a(n/2)-a(n/2-1)| if n is even, and a(n) = a((n-1)/2) + a((n-1)/2+1) if n is odd. 1

%I #13 Nov 17 2020 09:46:00

%S 0,1,1,2,0,3,1,2,2,3,3,4,2,3,1,4,0,5,1,6,0,7,1,6,2,5,1,4,2,5,3,4,4,5,

%T 5,6,4,7,5,6,6,7,7,8,6,7,5,8,4,7,3,6,4,5,3,6,2,7,3,8,2,7,1,8,0,9,1,10,

%U 0,11,1,10,2,11,3,12,2,11,1,12,0,13,1,14,0,15,1,14,2,13,1,12,2,13,3,12,4,11,3,10,4,9,3,10,2,9,1,8,2,9,3,8,4,9,5,10,4,11,5,10

%N a(n) = n if n<2; a(n) = |a(n/2)-a(n/2-1)| if n is even, and a(n) = a((n-1)/2) + a((n-1)/2+1) if n is odd.

%H Alois P. Heinz, <a href="/A068915/b068915.txt">Table of n, a(n) for n = 0..10000</a>

%e a(2) = |1-0| = 1, a(3) = 1+1 = 2, a(4) = |1-1| = 0, a(5) = 1+2 = 3.

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

%p if n<2 then n

%p elif irem (n, 2)=0 then abs(a(n/2)-a(n/2-1))

%p else a((n-1)/2)+a((n-1)/2+1)

%p fi

%p end:

%p seq (a(n), n=0..119);

%t a[n_] := a[n] = If[n<2, n, If[EvenQ[n], Abs[a[n/2] - a[n/2-1]], a[(n-1)/2] + a[(n-1)/2 + 1]]];

%t a /@ Range[0, 119] (* _Jean-François Alcover_, Nov 17 2020 *)

%K easy,nonn

%O 0,4

%A Aaron K. Johnson (akj(AT)21stcentury.net), Mar 06 2002

%E Edited by _Alois P. Heinz_, Feb 04 2011

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.

Last modified May 28 16:48 EDT 2024. Contains 372916 sequences. (Running on oeis4.)