A114994 Numbers whose binary representation has monotonically decreasing sizes of groups of zeros (including zero-length groups between adjacent ones).
0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 21, 23, 31, 32, 33, 34, 35, 36, 37, 39, 42, 43, 47, 63, 64, 65, 66, 67, 68, 69, 71, 73, 74, 75, 79, 85, 87, 95, 127, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 143, 146, 147, 149, 151, 159, 170, 171, 175
Offset: 0
Examples
21 is included, binary 10101 has group sizes 1,1,0; 22 is not, binary 10110 has group sizes 1,0,1, which includes an increase. Applying bits of 21 in order gives sequence of partitions: [], [1], [2], [2,1], [2^2], [2^2,1], so 21 represents the partition [2^2,1]. From _Omar E. Pol_, Aug 04 2013: (Start) The positive terms written as an irregular triangle begins: 1; 2, 3; 4, 5, 7; 8, 9, 10, 11, 15; 16, 17, 18, 19, 21, 23, 31; 32, 33, 34, 35, 36, 37, 39, 42, 43, 47, 63; 64, 65, 66, 67, 68, 69, 71, 73, 74, 75, 79, 85, 87, 95, 127; ... Column 1 is A000079. Right border gives A000225, n >= 1. T(n,k) represents the k-th partition of n. Example: for n = 5 the seven partitions of 5 (in Mathematica order) are represented in three ways as shown below. The last column (16, 17, 18, 19, 21, 23, 31) is also the 5th row of triangle. ----------------------------------- Partitions Binary Decimal of 5 number value ----------------------------------- 5 10000 16 4+1 10001 17 3+2 10010 18 3+1+1 10011 19 2+2+1 10101 21 2+1+1+1 10111 23 1+1+1+1+1 11111 31 (End) From _Peter J. C. Moses_, Dec 09 2013: (Start) Let us illustrate an algorithm of calculation of all terms in interval of the form [2^k,2^(k+1)). Let k=5. Consider all integer partitions of 5+1=6 ordered over decreasing of maximal parts (see algorithm IntegerPartitions). We have: {{6},{5,1},{4,2},{4,1,1},{3,3},{3,2,1},{3,1,1,1},{2,2,2},{2,2,1,1},{2,1,1,1,1},{1,1,1,1,1,1}}. Now for every number, i, replace it with 1 followed by (i-1) 0's. So that becomes: {{1,0,0,0,0,0},{1,0,0,0,0,1},{1,0,0,0,1,0},{1,0,0,0,1,1},{1,0,0,1,0,0},{1,0,0,1,0,1},{1,0,0,1,1,1},{1,0,1,0,1,0},{1,0,1,0,1,1},{1,0,1,1,1,1},{1,1,1,1,1,1}}. Finally, reading these as binary numbers with transformation of them into decimal, we obtain all terms in interval [32,64): {32,33,34,35,36,37,39,42,43,47,63}. (End)
Links
- Peter J. C. Moses, Table of n, a(n) for n = 0..4999
Crossrefs
Programs
-
Mathematica
Select[Range[0, 200], FromDigits[Flatten[Sort[Split[IntegerDigits[#, 2], #1>#2||#2==0&], Length[#1]>Length[#2]&]], 2]==#&] (* Peter J. C. Moses, Dec 04 2013 *) f:=Map[IntegerDigits[2^(#-1), 2]&, #]&; Flatten[Map[Map[FromDigits[#, 2]&, Map[Flatten, f[IntegerPartitions[#]]]]&, Range[0, 10]]] (* Peter J. C. Moses, Dec 05 2013 *)
-
PARI
is(n, k=0)=if(n==0, return(1)); my(e=valuation(n, 2)); if(e
>(e+1), e)) \\ Charles R Greathouse IV, Dec 05 2013
Formula
For n>=0, 2n+1 is in the sequence iff n is in the sequence. For n>0, 2n is in the sequence iff both n is the sequence and, for some k>=0, n is congruent to 2^k mod 4^(k+1).
Number terms in interval [2^(n-1), 2^n) is A000041(n); number terms <2^n is A000070(n). - Vladimir Shevelev, Dec 06 2013
Comments