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.
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!)
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
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, 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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
LINKS
EXAMPLE
a(2) = |1-0| = 1, a(3) = 1+1 = 2, a(4) = |1-1| = 0, a(5) = 1+2 = 3.
MAPLE
a:= proc(n) option remember;
if n<2 then n
elif irem (n, 2)=0 then abs(a(n/2)-a(n/2-1))
else a((n-1)/2)+a((n-1)/2+1)
fi
end:
seq (a(n), n=0..119);
MATHEMATICA
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]]];
a /@ Range[0, 119] (* Jean-François Alcover, Nov 17 2020 *)
CROSSREFS
Sequence in context: A080096 A322978 A294142 * A302193 A133925 A071492
KEYWORD
easy,nonn
AUTHOR
Aaron K. Johnson (akj(AT)21stcentury.net), Mar 06 2002
EXTENSIONS
Edited by Alois P. Heinz, Feb 04 2011
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 May 14 07:57 EDT 2024. Contains 372530 sequences. (Running on oeis4.)