OFFSET
0,4
LINKS
Antti Karttunen, Rows 0..255, flattened
EXAMPLE
The n-th row (starting indexing from zero) in this irregular table consists of block of length A071542(n)+1: 1,2,3,3,4,4,5,5,... which always ends with zero, as:
0
1,0
2,1,0
3,1,0
4,3,1,0
5,3,1,0
6,4,3,1,0
7,4,3,1,0
The 17th term is 6, which in binary is 110. The 18th term is then 6-2=4.
PROG
(MIT/GNU Scheme)
;; with Antti Karttunen's intseq additions:
(definec (A218254 n) (cond ((< n 2) n) ((not (zero? (A218254 (- n 1)))) (- (A218254 (- n 1)) (A000120 (A218254 (- n 1))))) (else (+ 1 (A218254 (+ 1 (Apos_of_prev_zero (- n 1))))))))
;; The following is an auxiliary function not submitted as a separate entry:
(PARI) for(n=0, 9, k=n; while(k, print1(k", "); k-=hammingweight(k)); print1("0, ")) \\ Charles R Greathouse IV, Oct 30 2012
CROSSREFS
KEYWORD
nonn,tabf,easy
AUTHOR
Nico Brown, Oct 24 2012
STATUS
approved