login

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”).

A254044
a(1) = 1, for n>1: a(n) = a(A253889(n)) + (1 if n is of the form 3n or 3n+1, otherwise 0).
6
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, 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, 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
OFFSET
1,3
LINKS
FORMULA
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).
a(1) = 0, thereafter, if n = 3k+2, then a(n) = a((n+1)/3), otherwise a(n) = 1 + a(A253889(n)).
a(n) = A000120(A064216(n)). [Binary weight of terms of A064216.]
a(n) = A253894(n) - A254045(n).
Other identities:
a(A007051(n)) = 1 for all n >= 0. [And no 1's in any other positions.]
PROG
(Scheme, two versions using memoization-macro definec)
(definec (A254044 n) (if (= 1 n) 1 (+ (A254044 (A253889 n)) (- 1 (floor->exact (/ (modulo n 3) 2))))))
(definec (A254044 n) (cond ((= 1 n) 1) ((= 2 (modulo n 3)) (A254044 (/ (+ 1 n) 3))) (else (+ 1 (A254044 (A253889 n))))))
;; Alternatively:
(define (A254044 n) (A000120 (A064216 n)))
CROSSREFS
Positions of ones: A007051.
Sequence in context: A364197 A097291 A269501 * A274515 A362500 A291564
KEYWORD
nonn
AUTHOR
Antti Karttunen, Jan 23 2015
STATUS
approved