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!)
A266569 a(1) = 1; thereafter a(2k) = 4k + a(k); a(2k+1) = k + a(4k+4). 7

%I #32 May 06 2016 06:52:02

%S 1,5,30,13,68,42,64,29,132,88,119,66,154,92,132,61,248,168,217,128,

%T 261,163,221,114,322,206,273,148,326,192,268,125,468,316,401,240,463,

%U 293,387,208,533,345,448,251,519,313,425,210,646,422,543,310,623,381,511

%N a(1) = 1; thereafter a(2k) = 4k + a(k); a(2k+1) = k + a(4k+4).

%H Daniel Suteu, <a href="/A266569/b266569.txt">Table of n, a(n) for n = 1..10000</a>

%H Daniel Suteu, <a href="/A266569/a266569.txt">Table of n, a(n) for n = 1..100000</a>

%e For n=2, a(2) = 4 + a(1) = 5.

%e For n=3:

%e a(3) = 1 + a(8);

%e a(8) = 2*8 + a(8/2) = 16 + a(4);

%e a(4) = 2*4 + a(4/2) = 8 + a(2) = 13;

%e a(8) = 18+13 = 29;

%e a(3) = 1 + 29 = 30.

%p A266569 := proc(n)

%p option remember;

%p local k;

%p if n = 1 then

%p 1;

%p elif type(n,'even') then

%p 2*n+procname(n/2) ;

%p else

%p k := (n-1)/2 ;

%p k+procname(4*k+4) ;

%p end if;

%p end proc:

%p seq(A266569(n),n=1..100) ; # _R. J. Mathar_, May 06 2016

%t a[1] = 1; a[n_] := a[n] = If[EvenQ@ n, 2 n + a[n/2], (n - 1)/2 + a[2 (n + 1)]]; Array[a, 55] (* _Michael De Vlieger_, Jan 02 2016 *)

%o (Sidef)

%o func a((1)) { 1 }

%o func a(n {.is_even}) is cached { 2*n + a(n/2) }

%o func a(n {.is_odd }) is cached { (n-1)/2 + a(2*(n + 1)) }

%o 1000.times { |n| say a(n) }

%Y Records (high water marks): A270811, A270812.

%Y Cf. A270814, A271473, A271478, A271479.

%K nonn,easy

%O 1,2

%A _Daniel Suteu_, Jan 01 2016

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 April 18 20:18 EDT 2024. Contains 371781 sequences. (Running on oeis4.)