A243503
Sums of parts of partitions (i.e., their sizes) as ordered in the table A241918: a(n) = Sum_{i=A203623(n-1)+2..A203623(n)+1} A241918(i).
Original entry on oeis.org
0, 1, 2, 2, 3, 4, 4, 3, 3, 6, 5, 6, 6, 8, 5, 4, 7, 5, 8, 9, 7, 10, 9, 8, 4, 12, 4, 12, 10, 8, 11, 5, 9, 14, 6, 7, 12, 16, 11, 12, 13, 11, 14, 15, 7, 18, 15, 10, 5, 7, 13, 18, 16, 6, 8, 16, 15, 20, 17, 11, 18, 22, 10, 6, 10, 14, 19, 21, 17, 10, 20, 9, 21, 24, 6, 24
Offset: 1
Sums of even-indexed rows of
A358172.
-
Table[If[n==1,0,With[{y=Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]},Last[y]*Length[y]+Last[y]-Total[y]+Length[y]-1]],{n,100}] (* Gus Wiseman, Jan 09 2023 *)
A322827
A permutation of A025487: Sequence of least representatives of distinct prime signatures obtained from the run lengths present in the binary expansion of n.
Original entry on oeis.org
1, 2, 6, 4, 36, 30, 12, 8, 216, 180, 210, 900, 72, 60, 24, 16, 1296, 1080, 1260, 5400, 44100, 2310, 6300, 27000, 432, 360, 420, 1800, 144, 120, 48, 32, 7776, 6480, 7560, 32400, 264600, 13860, 37800, 162000, 9261000, 485100, 30030, 5336100, 1323000, 69300, 189000, 810000, 2592, 2160, 2520, 10800, 88200, 4620, 12600
Offset: 0
The sequence can be represented as a binary tree:
1
|
...................2...................
6 4
36......../ \........30 12......../ \........8
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
216 180 210 900 72 60 24 16
etc.
Both children are multiples of their common parent, see A323503, A323504 and A323507.
The value of a(n) is computed from the binary expansion of n as follows: Starting from the least significant end of the binary expansion of n (A007088), we record the successive run lengths, subtract one from all lengths except the first one, and use the reversed partial sums of these adjusted values as the exponents of successive primes.
For 11, which is "1011" in base 2, we have run lengths [2, 1, 1] when scanned from the right, and when one is subtracted from all except the first, we have [2, 0, 0], partial sums of which is [2, 2, 2], which stays same when reversed, thus a(11) = 2^2 * 3^2 * 5^2 = 900.
For 13, which is "1101" in base 2, we have run lengths [1, 1, 2] when scanned from the right, and when one is subtracted from all except the first, we have [1, 0, 1], partial sums of which is [1, 1, 2], reversed [2, 1, 1], thus a(13) = 2^2 * 3^1 * 5^1 = 60.
Sequence A227183 is based on the same algorithm.
Cf.
A000079 (right edge),
A000400 (left edge, apart from 2),
A005811,
A046523,
A101296,
A227183,
A322585,
A322825,
A323503,
A323504,
A323507.
-
{1}~Join~Array[Times @@ MapIndexed[Prime[First@ #2]^#1 &, Reverse@ Accumulate@ MapIndexed[Length[#1] - Boole[First@ #2 > 1] &, Split@ Reverse@ IntegerDigits[#, 2]]] &, 54] (* Michael De Vlieger, Feb 05 2020 *)
-
A322827(n) = if(!n,1,my(bits = Vecrev(binary(n)), rl=1, o = List([])); for(i=2,#bits,if(bits[i]==bits[i-1], rl++, listput(o,rl))); listput(o,rl); my(es=Vecrev(Vec(o)), m=1); for(i=1,#es,m *= prime(i)^es[i]); (m));
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))))
A243354
Permutation of natural numbers which maps between the partitions as encoded in A112798 (prime-index based system, one-based) to A227739 (binary based system, zero-based).
Original entry on oeis.org
0, 1, 3, 2, 7, 6, 15, 5, 4, 14, 31, 13, 63, 30, 12, 10, 127, 9, 255, 29, 28, 62, 511, 26, 8, 126, 11, 61, 1023, 25, 2047, 21, 60, 254, 24, 18, 4095, 510, 124, 58, 8191, 57, 16383, 125, 27, 1022, 32767, 53, 16, 17, 252, 253, 65535, 22, 56, 122, 508, 2046, 131071
Offset: 1
A163575
Remove all trailing bits equal to (n mod 2) in binary representation of n.
Original entry on oeis.org
0, 1, 0, 1, 2, 3, 0, 1, 4, 5, 2, 3, 6, 7, 0, 1, 8, 9, 4, 5, 10, 11, 2, 3, 12, 13, 6, 7, 14, 15, 0, 1, 16, 17, 8, 9, 18, 19, 4, 5, 20, 21, 10, 11, 22, 23, 2, 3, 24, 25, 12, 13, 26, 27, 6, 7, 28, 29, 14, 15, 30, 31, 0, 1, 32, 33, 16, 17, 34, 35, 8, 9, 36, 37, 18, 19, 38, 39, 4, 5, 40, 41, 20
Offset: 1
Helmut Kreindl (euler(AT)chello.at), Jul 31 2009
a(7) = a(111_2) = 0_2 = 0 (when the rightmost and only run of bits in 7's binary representation has been shifted off, only zero remains).
a(17) = a(10001_2) = 1000_2 = 8.
a(8) = a(1000_2) = 1_2 = 1.
-
FUNCTION CHANGEPOINT
INPUT n
IF EVEN(n)
WHILE EVEN(n)
n = n/2
ELSE
WHILE NOT EVEN(n)
n = (n-1)/2
OUTPUT n
-
a163575 n = f n' where
f 0 = 0
f x = if b == parity then f x' else x where (x', b) = divMod x 2
(n', parity) = divMod n 2
-- Reinhard Zumkeller, Jul 22 2014
-
f[n_] := Block[{idn = IntegerDigits[n, 2], m = Mod[n, 2]}, While[ idn[[-1]] == m, idn = Most@ idn]; FromDigits[ idn, 2]]; Array[f, 83] (* or *)
f[n_] := Block[{m = n}, If[ OddQ@ m, While[OddQ@m, m--; m /= 2], While[ EvenQ@ m, m /= 2]]; m]; Array[f, 83] (* Robert G. Wilson v, Jul 04 2015 *)
-
a(n) = {odd = n%2; while (n%2 == odd, n \= 2); return(n);} \\ Michel Marcus, Jun 20 2013
-
a(n)=if(n%2,(n+1)>>valuation(n+1,2)-1,n>>valuation(n,2)) \\ Charles R Greathouse IV, Jul 05 2013
(MIT/GNU Scheme) (define (A163575 n) (floor->exact (/ n (expt 2 (A136480 n))))) ;; Antti Karttunen, Jul 05 2013
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)))))
A227192
Sum of the partial sums of the run lengths of binary expansion of n, when starting scanning from the least significant end; Row sums of A227188 and A227738.
Original entry on oeis.org
1, 3, 2, 5, 6, 4, 3, 7, 8, 10, 9, 6, 7, 5, 4, 9, 10, 12, 11, 14, 15, 13, 12, 8, 9, 11, 10, 7, 8, 6, 5, 11, 12, 14, 13, 16, 17, 15, 14, 18, 19, 21, 20, 17, 18, 16, 15, 10, 11, 13, 12, 15, 16, 14, 13, 9, 10, 12, 11, 8, 9, 7, 6, 13, 14, 16, 15, 18, 19, 17, 16
Offset: 1
For 11, whose binary expansion is "1011", the run lengths, when starting scanning from the right, are: [2,1,1]. Their partial sums are [2,2+1,2+1+1] = [2,3,4] which sum to total 9, thus a(11)=9. Equivalently, the zero-based positions (counted from the right) where bits change from one to zero or vice versa in "...01011" are 2, 3, 4 and 2+3+4 = 9.
For 13, whose binary expansion is "1101", the run lengths similarly scanned are [1,1,2]. Their partial sums are [1,1+1,1+1+2] = [1,2,4] which sum to total 7, thus a(13)=7. Equivalently, the positions where bits change in "...01101" are 1, 2, 4 and 1+2+4 = 7.
-
Table[Tr[FoldList[Plus,0,Length /@ Split[Reverse[IntegerDigits[n,2]]]] ],{n,71}] (* Wouter Meeussen, Aug 22 2013 *)
-
a(n)=local(b,s,t);b=binary(n);s=#b;t=b[#b];forstep(i=#b-1,1,-1,if(b[i]!=t,s=s+#b-i;t=!t));s /* Ralf Stephan, Sep 04 2013 */
-
def A227192(n):
'''Sum of the partial sums of the run lengths of binary expansion of n, starting from the least significant end.'''
s = 0
b = n%2
i = 0
while (n != 0):
n >>= 1
i += 1
if((n%2) != b):
b = n%2
s += i
return(s)
-
def a(n)
k = n.to_s(2).scan(/((\d)\2*)/)
k.each_index.map { |i| (i + 1) * k[i][0].size }.reduce(:+)
end # Peter Kagey, Aug 06 2015
-
(define (A227192 n) (let loop ((i (- (A005811 n) 1)) (s 0)) (cond ((< i 0) s) (else (loop (- i 1) (+ s (A227188bi n i))))))) ;; This version sums the nonzero terms of the n-th row of table A227188.
(define (A227192v2 n) (+ (A227183 n) (A000217 (- (A005811 n) 1)))) ;; Another variant.
(define (A227192v3 n) (add A227738 (+ 1 (A173318 (- n 1))) (A173318 n))) ;; This sums terms of table A227738.
;; With the help of this function that implements Sum_{i=lowlim..uplim} intfun(i)
(define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
Original entry on oeis.org
0, 1, 2, 4, 3, 6, 5, 8, 7, 9, 10, 11, 12, 13, 14, 16, 15, 18, 17, 20, 19, 22, 21, 24, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 35, 38, 37, 40, 39, 42, 41, 44, 43, 46, 45, 48, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 63, 66, 65, 68, 67
Offset: 0
A225794
Sizes of Garden of Eden partitions in Bulgarian Solitaire, given in the same order as the runlength codes of the corresponding partitions (A227753).
Original entry on oeis.org
3, 4, 6, 8, 5, 7, 5, 7, 9, 6, 10, 8, 6, 9, 11, 8, 12, 10, 13, 10, 14, 12, 7, 11, 15, 12, 9, 13, 11, 8, 10, 7, 11, 9, 7, 10, 12, 14, 9, 13, 11, 14, 16, 11, 15, 18, 13, 8, 14, 17, 12, 16, 13, 15, 10, 14, 12, 9, 11, 13, 8, 12, 10, 8, 12, 14, 16, 11, 15, 13, 16, 18
Offset: 1
Comments