OFFSET
0,6
COMMENTS
a(n) is also the number of distinct parts in the integer partition having viabin number n. The viabin number of an integer partition is defined in the following way. Consider the southeast border of the Ferrers board of the integer partition and consider the binary number obtained by replacing each east step with 1 and each north step, except the last one, with 0. The corresponding decimal form is, by definition, the viabin number of the given integer partition. "Viabin" is coined from "via binary". For example, consider the integer partition [2,2,2,1]. The southeast border of its Ferrers board yields 10100, leading to the viabin number 20. - Emeric Deutsch, Jul 24 2017
Positions of first occurrences of k are A002450(k). - John Keith, Aug 30 2021
LINKS
Tilman Piesk (terms 0..9999) & Antti Karttunen, Table of n, a(n) for n = 0..16384
Louis Marin, Counting Polyominoes in a Rectangle b X h, arXiv:2406.16413 [cs.DM], 2024. See p. 148.
Vladimir Shevelev, Two analogs of Thue-Morse sequence, arXiv:1603.04434 [math.NT], 2016.
Ralf Stephan, Some divide-and-conquer sequences ...
Ralf Stephan, Table of generating functions
FORMULA
a(n) = ceiling(A005811(n)/2) = A005811(n) - A033264(n). If 2^k <= n < 3*2^(k-1) then a(n) = a(n-2^k)+1; if 3*2^(k-1) <= n < 2^(k+1) then a(n) = a(n-2^k).
a(2n) = a(n), a(2n+1) = a(n) + [n is even]. - Ralf Stephan, Aug 20 2003
G.f.: (1/(1-x)) * Sum_{k>=0} (t/(1+t))/(1+t^2), where t=x^2^k. - Ralf Stephan, Sep 07 2003
EXAMPLE
a(11) = 2 since 11 is 1011 in binary with two runs of 1's.
a(12) = 1 since 12 is 1100 in binary with one run of 1's.
MAPLE
f:= proc(n) option remember; if n::even then procname(n/2)
elif n mod 4 = 1 then 1 + procname((n-1)/2) else procname((n-1)/2) fi end proc:
f(0):= 0:
map(f, [$0..1000]); # Robert Israel, Sep 06 2015
MATHEMATICA
Count[Split@ IntegerDigits[#, 2], n_ /; First@ n == 1] & /@ Range[0, 120] (* Michael De Vlieger, Sep 05 2015 *)
PROG
(PARI) a(n) = (1 + (hammingweight(bitxor(n, n>>1)))) >> 1; \\ Gheorghe Coserea, Sep 05 2015
(Python)
def A069010(n):
return sum(1 for d in bin(n)[2:].split('0') if len(d)) # Chai Wah Wu, Nov 04 2016
CROSSREFS
Cf. A002450 (positions of record highs).
KEYWORD
base,easy,nonn
AUTHOR
Henry Bottomley, Apr 02 2002
STATUS
approved