A227739
Irregular table where row n lists in nondecreasing order the parts of unordered partition encoded in the runlengths of binary expansion of n; nonzero terms of A227189.
Original entry on oeis.org
1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 2, 3, 3, 3, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 3, 1, 1, 2, 1, 3, 4, 4, 4, 1, 3, 3, 1, 1, 2, 2, 2, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 2, 4, 1, 1, 3, 1, 4, 5, 5, 5, 1, 4, 4, 1, 1
Offset: 1
Rows are constructed as:
Row n in Runlengths With one Partial sums The row sums
n binary collected subtracted of which give to, i.e. is
from lsb- from all terms on a partition of
to msb-end except 1st that row of A227183(n)
1 "1" [1] [1] 1; 1
2 "10" [1,1] [1,0] 1, 1; 2
3 "11" [2] [2] 2; 2
4 "100" [2,1] [2,0] 2, 2; 4
5 "101" [1,1,1] [1,0,0] 1, 1, 1; 3
6 "110" [1,2] [1,1] 1, 2; 3
7 "111" [3] [3] 3; 3
8 "1000" [3,1] [3,0] 3, 3; 6
9 "1001" [1,2,1] [1,1,0] 1, 2, 2; 5
10 "1010" [1,1,1,1] [1,0,0,0] 1, 1, 1, 1; 4
11 "1011" [2,1,1] [2,0,0] 2, 2, 2; 6
12 "1100" [2,2] [2,1] 2, 3; 5
13 "1101" [1,1,2] [1,0,1] 1, 1, 2; 4
14 "1110" [1,3] [1,2] 1, 3; 4
15 "1111" [4] [4] 4; 4
16 "10000" [4,1] [4,0] 4, 4; 8
-
Table[Function[b, Accumulate@ Prepend[If[Length@ b > 1, Rest[b] - 1, {}], First@ b]]@ Map[Length, Split@ Reverse@ IntegerDigits[n, 2]], {n, 34}] // Flatten (* Michael De Vlieger, May 09 2017 *)
-
(define (A227739 n) (A227189bi (A227737 n) (A227740 n))) ;; The Scheme-code for A227189bi has been given in A227189.
A227183
a(n) is the sum of parts of the unique unordered partition encoded in the run lengths of the binary expansion of n; row sums of A227739 for n >= 1.
Original entry on oeis.org
0, 1, 2, 2, 4, 3, 3, 3, 6, 5, 4, 6, 5, 4, 4, 4, 8, 7, 6, 8, 8, 5, 7, 9, 7, 6, 5, 7, 6, 5, 5, 5, 10, 9, 8, 10, 10, 7, 9, 11, 12, 9, 6, 10, 11, 8, 10, 12, 9, 8, 7, 9, 9, 6, 8, 10, 8, 7, 6, 8, 7, 6, 6, 6, 12, 11, 10, 12, 12, 9, 11, 13, 14, 11, 8, 12, 13, 10, 12, 14
Offset: 0
19 has binary expansion "10011", thus the maximal runs of identical bits (scanned from right to left) are [2,2,1]. We subtract one from each after the first one, to get [2,1,0] and then form their partial sums as [2,2+1,2+1+0], which thus maps to unordered partition {2+3+3} which adds to 8. Thus a(19)=8.
-
Table[Function[b, Total@ Accumulate@ Prepend[If[Length@ b > 1, Rest[b] - 1, {}], First@ b] - Boole[n == 0]]@ Map[Length, Split@ Reverse@ IntegerDigits[n, 2]], {n, 0, 79}] // Flatten (* Michael De Vlieger, May 09 2017 *)
-
def A227183(n):
'''Sum of parts of the unique unordered partition encoded in the run lengths of the binary expansion of n.'''
s = 0
b = n%2
i = 1
while (n != 0):
n >>= 1
if ((n%2) == b): # Staying in the same run of bits?
i += 1
else: # The run changes.
b = n%2
s += i
return(s)
A129594
Involution of nonnegative integers induced by the conjugation of the partition encoded in the run lengths of binary expansion of n.
Original entry on oeis.org
0, 1, 3, 2, 4, 7, 6, 5, 11, 12, 15, 8, 9, 14, 13, 10, 20, 27, 28, 19, 16, 31, 24, 23, 22, 25, 30, 17, 18, 29, 26, 21, 43, 52, 59, 36, 35, 60, 51, 44, 47, 48, 63, 32, 39, 56, 55, 40, 41, 54, 57, 38, 33, 62, 49, 46, 45, 50, 61, 34, 37, 58, 53, 42, 84, 107, 116, 75, 68, 123
Offset: 0
a(8) = 11, as 8 is 1000 in binary, mapping to composition 3+1 (we scan the binary expansion from the least to the most significant end), which maps to partition 3+3, whose conjugate-partition is 2+2+2, yielding composition 2+1+1, which maps to binary 1011, 11 in decimal. a(13) = 14, as 13 is 1101 in binary, mapping to composition 1+1+2, which maps to the partition 1+1+2, whose conjugate-partition is 1+3, yielding composition 1+3, which maps to binary 1110, 14 in decimal. a(11) = 8 and a(14) = 13, as taking the conjugate of a partition is a self-inverse operation.
Sequences related to partitions encoded in this way:
Cf.
A227189 (parts of partitions listed on separate rows of the array).
Cf.
A005811 (number of parts in the partition).
Cf.
A136480 (for n>= 1, the smallest part).
A227184
a(n) = product of parts of the unordered partition encoded with the runlengths of binary expansion of n.
Original entry on oeis.org
1, 1, 1, 2, 4, 1, 2, 3, 9, 4, 1, 8, 6, 2, 3, 4, 16, 9, 4, 18, 16, 1, 8, 27, 12, 6, 2, 12, 8, 3, 4, 5, 25, 16, 9, 32, 36, 4, 18, 48, 81, 16, 1, 32, 54, 8, 27, 64, 20, 12, 6, 24, 24, 2, 12, 36, 15, 8, 3, 16, 10, 4, 5, 6, 36, 25, 16, 50, 64, 9, 32, 75, 144, 36, 4, 72
Offset: 0
8 has binary expansion "1000", whose runs have lengths [3,1] when arranged from the least significant to the most significant end. Taking partial sums of 3 and 0, we get 3 and 3, whose product is 9, thus a(8) = 9.
For 44, in binary "101100", the run lengths are [2,2,1,1] (from the least significant end), and subtracting one from all terms except the first one, we get [2,1,0,0], whose partial sums are [2,3,3,3], and 2*3*3*3 = 54, thus a(44)=54.
For n>=1, a(n) gives the product of nonzero terms on row n of table
A227189/
A227739.
Cf.
A227183 (gives the corresponding sums).
See also
A167489 for a similar sequence, which gives the product of parts of the compositions (ordered partitions).
-
Table[Function[b, Times @@ Accumulate@ Prepend[If[Length@ b > 1, Rest[b] - 1, {}], First@ b]]@ Map[Length, Split@ Reverse@ IntegerDigits[n, 2]], {n, 0, 75}] // Flatten (* Michael De Vlieger, May 09 2017 *)
-
def A227184(n):
'''Product of parts of the unique unordered partition encoded in the run lengths of the binary expansion of n.'''
p = 1
b = n%2
i = 1
while (n != 0):
n >>= 1
if ((n%2) == b): i += 1
else:
b = n%2
p *= i
return(p)
-
(define (A227184 n) (if (zero? n) 1 (apply * (binexp_to_ascpart n))))
(define (binexp_to_ascpart n) (let ((runlist (reverse! (binexp->runcount1list n)))) (PARTSUMS (cons (car runlist) (map -1+ (cdr runlist))))))
(define (binexp->runcount1list n) (if (zero? n) (list) (let loop ((n n) (rc (list)) (count 0) (prev-bit (modulo n 2))) (if (zero? n) (cons count rc) (if (eq? (modulo n 2) prev-bit) (loop (floor->exact (/ n 2)) rc (1+ count) (modulo n 2)) (loop (floor->exact (/ n 2)) (cons count rc) 1 (modulo n 2)))))))
(define (PARTSUMS a) (cdr (reverse! (fold-left (lambda (psums n) (cons (+ n (car psums)) psums)) (list 0) a))))
A227368
a(n) = Index k where A227183(k) for the first time gets value n; the runlength binary code for minimally runlength-encoded unordered partition of size n.
Original entry on oeis.org
0, 1, 2, 5, 4, 9, 8, 17, 16, 23, 32, 39, 40, 71, 72, 87, 80, 151, 144, 167, 160, 295, 288, 327, 320, 351, 576, 607, 640, 671, 672, 1183, 1184, 1311, 1312, 1375, 1344, 2399, 2368, 2655, 2624, 2719, 2688, 4767, 4736, 5279, 5248, 5407, 5376, 5503, 9472, 9599, 10496
Offset: 0
n a(n) binary corresponding partition sum = n
(cf. A227183 for details)
0 0 0 (0) 0
1 1 1 (1) 1
2 2 10 (1 + 1) 2
3 5 101 (1 + 1 + 1) 3
4 4 100 (2 + 2) 4
5 9 1001 (1 + 2 + 2) 5
6 8 1000 (3 + 3) 6
7 17 10001 (1 + 3 + 3) 7
8 16 10000 (4 + 4) 8
9 23 10111 (3 + 3 + 3) 9
10 32 100000 (5 + 5) 10
11 39 100111 (3 + 4 + 4) 11
12 40 101000 (3 + 3 + 3 + 3) 12
13 71 1000111 (3 + 5 + 5) 13
14 72 1001000 (3 + 3 + 4 + 4) 14
15 87 1010111 (3 + 3 + 3 + 3 + 3) 15
16 80 1010000 (4 + 4 + 4 + 4) 16
17 151 10010111 (3 + 3 + 3 + 4 + 4) 17
18 144 10010000 (4 + 4 + 5 + 5) 18
19 167 10100111 (3 + 4 + 4 + 4 + 4) 19
20 160 10100000 (5 + 5 + 5 + 5) 20
a(5) = 9, because 5 occurs for the first time in A227183 as A227183(9).
Note that for 20, there is for example also a code 175, "10101111" in binary, which results a partition (4 + 4 + 4 + 4 + 4) (= 20), but as 160 < 175, and there are no other partitions of 20 which would result even smaller code number, 160 is the winner (the minimal code), and thus a(20)=160.
A227761 gives the maximum difference between successive parts that occurs in these partitions.
Same sequence sorted into ascending order:
A227369.
A227185
The largest part in the unordered partition encoded in the runlengths of the binary expansion of n.
Original entry on oeis.org
0, 1, 1, 2, 2, 1, 2, 3, 3, 2, 1, 2, 3, 2, 3, 4, 4, 3, 2, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 3, 4, 5, 5, 4, 3, 4, 3, 2, 3, 4, 3, 2, 1, 2, 3, 2, 3, 4, 5, 4, 3, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 4, 5, 6, 6, 5, 4, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 3, 4, 5, 4, 3, 2, 3, 2, 1, 2
Offset: 0
12 has binary expansion "1100", for which the lengths of runs (consecutive blocks of 0- or 1-bits) are [2,2]. Converting this to a partition in the manner explained in A227184 gives the partition {2+3}. Its largest part is 3, thus a(12)=3, which is actually the first time when this sequence differs from A043276.
a(n) gives the rightmost nonzero term on the n-th row of
A227189.
-
Table[Function[b, Max@ Accumulate@ Prepend[If[Length@ b > 1, Rest[b] - 1, {}], First@ b] - Boole[n == 0]]@ Map[Length, Split@ Reverse@ IntegerDigits[ n, 2]], {n, 0, 120}] // Flatten (* Michael De Vlieger, May 09 2017 *)
-
(define (A227185 n) (if (zero? n) n (+ 1 (- (A029837 (+ 1 n)) (A005811 n)))))
(define (A227185v2 n) (if (zero? n) n (car (reverse (binexp_to_ascpart n))))) ;; Alternative definition, using the auxiliary functions given in A227184.
A227186
Array A(n,k) read by antidiagonals: the length of the (k+1)-th run (k>=0) of binary digits of n, first run starting from the least significant bit of n.
Original entry on oeis.org
0, 0, 1, 0, 0, 1, 0, 0, 1, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0
Offset: 0
The top-left corner of the array:
0, 0, 0, 0, 0, ... (0, in binary 0, has no runs (by convention), thus at first we have all-0 sequence)
1, 0, 0, 0, 0, ... (1, in binary 1, has one run of length 1)
1, 1, 0, 0, 0, ... (2, in binary 10, has two runs of length 1 both)
2, 0, 0, 0, 0, ... (3, in binary 11, has one run of length 2)
2, 1, 0, 0, 0, ... (4, in binary 100, the rightmost run of length 2 given first, then the second run of length 1)
1, 1, 1, 0, 0, ... (5, in binary 101, has three runs of one bit each)
1, 2, 0, 0, 0, ...
3, 0, 0, 0, 0, ...
3, 1, 0, 0, 0, ...
1, 2, 1, 0, 0, ...
1, 1, 1, 1, 0, ...
2, 1, 1, 0, 0, ...
2, 2, 0, 0, 0, ...
1, 1, 2, 0, 0, ...
1, 3, 0, 0, 0, ...
4, 0, 0, 0, 0, ...
-
A227186 := proc(n,k)
local bdgs,ru,i,b,a;
bdgs := convert(n,base,2) ;
if nops(bdgs) = 0 then
return 0 ;
end if;
ru := 0 ;
i := 1 ;
b := op(i,bdgs) ;
a := 1 ;
for i from 2 to nops(bdgs) do
if op(i,bdgs) <> op(i-1,bdgs) then
if ru = k then
return a;
end if;
a := 1 ;
ru := ru+1 ;
else
a := a+1 ;
end if;
end do:
if ru =k then
a ;
else
0 ;
end if;
end proc: # R. J. Mathar, Jul 23 2013
-
A227186(n,k)=while(k>=0,for(c=1,n,bittest(n,0)==bittest(n\=2,0)&next;k&break;return(c));n||return;k--) \\ To let A(0,0)=1 add "!n||!" in front of while(...). TO DO: add default value k=-1 and implement "flattened" sequence, such that A227186(n) yields a(n). M. Hasler, Jul 21 2013
-
(define (A227186 n) (A227186bi (A002262 n) (A025581 n)))
(define (A227186bi n k) (cond ((< (A005811 n) (+ 1 k)) 0) ((zero? k) (A136480 n)) (else (A227186bi (A163575 n) (- k 1)))))
A227188
Square array A(n,k) read by antidiagonals: the one-based bit-index where the (k+1)-st run in the binary expansion of n ends, as read from the least significant end.
Original entry on oeis.org
0, 0, 1, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 2
Offset: 0
The top-left corner of the array:
row # row starts as
0 0, 0, 0, 0, 0, ...
1 1, 0, 0, 0, 0, ...
2 1, 2, 0, 0, 0, ...
3 2, 0, 0, 0, 0, ...
4 2, 3, 0, 0, 0, ...
5 1, 2, 3, 0, 0, ...
6 1, 3, 0, 0, 0, ...
7 3, 0, 0, 0, 0, ...
8 3, 4, 0, 0, 0, ...
9 1, 3, 4, 0, 0, ...
10 1, 2, 3, 4, 0, ...
11 2, 3, 4, 0, 0, ...
12 2, 4, 0, 0, 0, ...
13 1, 2, 4, 0, 0, ...
14 1, 4, 0, 0, 0, ...
15 4, 0, 0, 0, 0, ...
16 4, 5, 0, 0, 0, ...
etc.
For example, for n = 8, whose binary expansion is "1000", we get the run lengths 3 and 1 (scanning from the right), partial sums of which are 3 and 4, thus row 8 begins as A(8,0)=3, A(8,1)=4, A(8,2)=0, ...
-
A227188 := proc(n,k)
local bdgs,ru,i,b,a;
bdgs := convert(n,base,2) ;
if nops(bdgs) = 0 then
return 0 ;
end if;
ru := 0 ;
i := 1 ;
b := op(i,bdgs) ;
for i from 2 to nops(bdgs) do
if op(i,bdgs) <> op(i-1,bdgs) then
if ru = k then
return i-1;
end if;
ru := ru+1 ;
end if;
end do:
if ru =k then
nops(bdgs) ;
else
0 ;
end if;
end proc: # R. J. Mathar, Jul 23 2013
-
Table[PadRight[Rest@FoldList[Plus,0,Length/@Split[Reverse[IntegerDigits[j,2]]]],i+1-j][[i+1-j]],{i,0,12},{j,0,i}] (* Wouter Meeussen, Aug 31 2013 *)
-
(define (A227188 n) (A227188bi (A002262 n) (A025581 n)))
(define (A227188bi n k) (cond ((< (A005811 n) (+ 1 k)) 0) ((zero? k) (A136480 n)) (else (+ (A136480 n) (A227188bi (A163575 n) (- k 1))))))
Showing 1-8 of 8 results.
Comments