OFFSET
1,2
COMMENTS
This sequence gives a way to enumerate unrestricted partitions of a number. The number of terms of this sequence that are each >= 2^(k-1) and <= 2^k -1 is equal to the number of unrestricted partitions of k.
Equivalently, numbers in whose binary representation the runs of 1's are in increasing order of length, the runs of 0's are in decreasing order of length, and all runs of 0's are at least as long as any run of 1's. The position of [1^m] in the partitions of m will be P(m-1). It is the last partition in the list with a part of size 1; anything with a part of size 2 or more will start 100... in the binary representation, while this partition starts 101...; and any partition that does not have a part of size 1 will start 11.... Removing one part of size 1 from the partitions of size m that have such a part gives each partition of m-1 uniquely. This relationship is expressed by the second formula of A002865. - Franklin T. Adams-Watters, Nov 03 2009
A000975 is a subsequence. - Alford Arnold, Nov 09 2009
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..14167 (Terms n <= 10^8).
EXAMPLE
9 in binary is 1001. The run lengths form the multiset (1,2,1). Since no positive integer < 9 has this same multiset of run lengths, then 9 is in this sequence. On the other hand, 23 in binary is 10111. The run-lengths are (1,1,3). But 17 (which is < 23) in binary is 10001, which has the run-lengths of (1,3,1). Since the multisets (1,1,3) and (1,3,1) are identical, then 23 is not in this sequence.
MAPLE
runLSet := proc(n) option remember ; local bdg, lset, arl, p ; bdg := convert(n, base, 2) ; lset := [] ; arl := -1 ; for p from 1 to nops(bdg) do if p = 1 then arl := 1 ; elif op(p, bdg) = op(p-1, bdg) then arl := arl+1 ; else if arl > 0 then lset := [arl, op(lset)] ; end if; arl := 1 ; end if; end do ; if arl > 0 then lset := [arl, op(lset)] ; end if; return lset ; end proc:
isA175020 := proc(n) local thisLset, k ; thisLset := runLSet(n) ; for k from 1 to n-1 do if convert(runLSet(k), multiset) = convert(thisLset, multiset) then return false; end if; end do ; return true; end proc:
for n from 1 to 300 do if isA175020(n) then printf("%d, ", n) ; end if; end do;
# R. J. Mathar, Feb 27 2010
MATHEMATICA
With[{s = Array[Sort@ Map[Length, Split@ IntegerDigits[#, 2]] &, 224]}, Values[PositionIndex@ s][[All, 1]]] (* Michael De Vlieger, Sep 03 2017 *)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Nov 03 2009
EXTENSIONS
More terms from Alford Arnold, Nov 09 2009
Terms beyond 64 by R. J. Mathar, Feb 27 2010
STATUS
approved