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!)
A230630 a(1)=0; thereafter a(n) = (1 + a(floor(n/2))) mod 3. 2

%I #22 Oct 13 2017 06:03:00

%S 0,1,1,2,2,2,2,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,

%T 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,

%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

%N a(1)=0; thereafter a(n) = (1 + a(floor(n/2))) mod 3.

%C For 2^i <= n < 2^(i+1), a(n) = (i mod 3).

%H Antti Karttunen, <a href="/A230630/b230630.txt">Table of n, a(n) for n = 1..32768</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(n) = A000523(n) (mod 3). - _John M. Campbell_, Jul 15 2016

%p f:=proc(n) option remember; if n=1 then 0 else (1+f(floor(n/2))) mod 3; fi; end; [seq(f(n),n=1..120)];

%t Fold[Append[#1, Mod[1 + #1[[Floor[#2/2]]], 3]] &, {0}, Range[2, 105]] (* _Michael De Vlieger_, Oct 10 2017 *)

%o (PARI) a(n)=logint(n,2)%3 \\ _Charles R Greathouse IV_, Jul 15 2016

%o (Scheme, with memoization-macro definec)

%o (definec (A230630 n) (if (= 1 n) 0 (modulo (+ 1 (A230630 (/ (- n (if (even? n) 0 1)) 2))) 3))) ;; _Antti Karttunen_, Oct 10 2017

%Y See A230629 for another version.

%Y Cf. A000523, A030300, A030301.

%K nonn,easy

%O 1,4

%A _N. J. A. Sloane_, Oct 30 2013

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 23 08:11 EDT 2024. Contains 371905 sequences. (Running on oeis4.)