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!)
A267363 a(0) = 0; a(odd n) = 2n+1; a(even n) = a(n/2 - a(n-1)). 1
0, 3, -9, 7, -9, 11, 27, 15, -21, 19, 99, 23, -33, 27, 63, 31, -45, 35, -117, 39, -57, 43, 99, 47, -69, 51, -873, 55, -81, 59, 135, 63, -93, 67, -225, 71, -105, 75, 171, 79, -117, 83, 423, 87, -129, 91, 207, 95, -141, 99, -333, 103, -153, 107, 243, 111, -165 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,2

LINKS

Daniel Suteu, Table of n, a(n) for n = 0..20000

FORMULA

a(0) = 0; a(odd n) = 2n+1; a(even n) = a(n/2 - a(n-1)).

MATHEMATICA

a[0] = 0; a[n_] := a[n] = If[OddQ@ n, 2 n + 1, a[n/2 - a[n - 1]]]; Table[a@ n, {n, 56}] (* Michael De Vlieger, Jan 13 2016 *)

PROG

(Sidef)

func a({.is_zero})   { 0 }

func a(n {.is_odd})  { 2*n + 1 }

func a(n) is cached  { a(n/2 - a(n-1)) }

0.to(10).each { |i| say a(i) }

(PARI) a(n) = if (n==0, 0, if (n % 2, 2*n+1, a(n/2 - a(n-1)))); \\ Michel Marcus, Jan 13 2016

CROSSREFS

Sequence in context: A046261 A074806 A010634 * A146179 A294734 A214661

Adjacent sequences:  A267360 A267361 A267362 * A267364 A267365 A267366

KEYWORD

sign,easy

AUTHOR

Daniel Suteu, Jan 13 2016

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 October 4 01:04 EDT 2022. Contains 357237 sequences. (Running on oeis4.)