OFFSET
1,4
COMMENTS
For 2^i <= n < 2^(i+1), a(n) = (i mod 3).
LINKS
FORMULA
a(n) = A000523(n) (mod 3). - John M. Campbell, Jul 15 2016
MAPLE
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)];
MATHEMATICA
Fold[Append[#1, Mod[1 + #1[[Floor[#2/2]]], 3]] &, {0}, Range[2, 105]] (* Michael De Vlieger, Oct 10 2017 *)
PROG
(PARI) a(n)=logint(n, 2)%3 \\ Charles R Greathouse IV, Jul 15 2016
(Scheme, with memoization-macro definec)
(definec (A230630 n) (if (= 1 n) 0 (modulo (+ 1 (A230630 (/ (- n (if (even? n) 0 1)) 2))) 3))) ;; Antti Karttunen, Oct 10 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Oct 30 2013
STATUS
approved