Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #15 Jan 26 2015 08:23:41
%S 1,1,2,2,1,3,3,2,3,2,2,3,2,1,4,4,3,4,5,3,3,3,2,4,3,3,5,3,2,4,5,2,2,5,
%T 3,3,4,2,3,3,1,5,4,4,4,5,4,4,4,3,3,4,4,5,5,5,5,4,3,2,3,3,4,4,3,7,4,2,
%U 3,3,4,4,3,3,4,4,3,5,5,5,6,5,3,4,5,2,5,4,4,5,5,5,5,5,2,5,7,2,3,4,5,5,6,3,6,5,3,6,3,4,5,5,2,7,5,3,5,2,3,5,7,1,4,6,5,5,3,4
%N a(1) = 1, for n>1: a(n) = a(A253889(n)) + (1 if n is of the form 3n or 3n+1, otherwise 0).
%H Antti Karttunen, <a href="/A254044/b254044.txt">Table of n, a(n) for n = 1..8192</a>
%F a(1) = 1, for n>1: a(n) = a(A253889(n)) + [n is of the form 3n or 3n+1, i.e., in A032766] (Here [ ] is Iverson bracket).
%F a(1) = 0, thereafter, if n = 3k+2, then a(n) = a((n+1)/3), otherwise a(n) = 1 + a(A253889(n)).
%F a(n) = A000120(A064216(n)). [Binary weight of terms of A064216.]
%F a(n) = A253894(n) - A254045(n).
%F Other identities:
%F a(A007051(n)) = 1 for all n >= 0. [And no 1's in any other positions.]
%o (Scheme, two versions using memoization-macro definec)
%o (definec (A254044 n) (if (= 1 n) 1 (+ (A254044 (A253889 n)) (- 1 (floor->exact (/ (modulo n 3) 2))))))
%o (definec (A254044 n) (cond ((= 1 n) 1) ((= 2 (modulo n 3)) (A254044 (/ (+ 1 n) 3))) (else (+ 1 (A254044 (A253889 n))))))
%o ;; Alternatively:
%o (define (A254044 n) (A000120 (A064216 n)))
%Y Positions of ones: A007051.
%Y Cf. A000120, A032766, A064216, A253889, A253894, A254045.
%K nonn
%O 1,3
%A _Antti Karttunen_, Jan 23 2015