cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 22 results. Next

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

Views

Author

Antti Karttunen, Jul 08 2013

Keywords

Comments

The word "minimally" in the description means that the integer in whose binary representation some unordered partition of n is encoded should be as small as possible. This sequence gives such a minimal integer for each n, which encodes an unordered partition whose sum is n. The details of the encoding system are explained in A227183.
Also, a(n) gives the index of the first row of A227189/A227739 which sums to n.
Project: Find an algorithm which computes a(n) with a more sophisticated method than just by a blind search. This is a kind of an optimization problem for representing n as a special "bit-packed" sum: the smallest summand of size x costs x bits, and its any subsequent usage in the sum costs just one bit each time. Using any additional summand y > x costs (y-x)+1 bits when used first time, and then again additional usages cost only one bit each. Goal: minimize the number of bits needed. If multiple candidates with the same number of bits are found, then the one which results the smallest integer (when interpreted as a binary number) wins.
For any composite n = t*u, the upper bound for the size of a(n) is t+u-1 bits.
A000267(n) seems to give the binary width of a(n+1). Compare to the conjecture given at A227370.

Examples

			   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.
		

Crossrefs

Same sequence sorted into ascending order: A227369.
Cf. also A227183, A227761, A227762.

Programs

  • Python
    def A227368(n):
      '''Index k where A227183(k) for the first time gets value n. A naive implementation.'''
      k = 0
      while(A227183(k) != n): k += 1
      return(k)

Formula

a(n) = A227369(A227370(n)) [See comments and conjecture at A227370]

A227189 Square array A(n>=0,k>=0) where A(n,k) gives the (k+1)-th part of the unordered partition which has been encoded in the binary expansion of n, as explained in A227183. The array is scanned antidiagonally as A(0,0), A(0,1), A(1,0), A(0,2), A(1,1), etc.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 0, 0, 1, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 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, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2
Offset: 0

Views

Author

Antti Karttunen, Jul 06 2013

Keywords

Comments

Discarding the trailing zero terms, on each row n there is a unique partition of integer A227183(n). All possible partitions of finite natural numbers eventually occur. The first partition that sums to n occurs at row A227368(n).
Irregular table A227739 lists only the nonzero terms.

Examples

			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, 1, 0, 0, 0, ...
    3  2, 0, 0, 0, 0, ...
    4  2, 2, 0, 0, 0, ...
    5  1, 1, 1, 0, 0, ...
    6  1, 2, 0, 0, 0, ...
    7  3, 0, 0, 0, 0, ...
    8  3, 3, 0, 0, 0, ...
    9  1, 2, 2, 0, 0, ...
   10  1, 1, 1, 1, 0, ...
   11  2, 2, 2, 0, 0, ...
   12  2, 3, 0, 0, 0, ...
   13  1, 1, 2, 0, 0, ...
   14  1, 3, 0, 0, 0, ...
   15  4, 0, 0, 0, 0, ...
   16  4, 4, 0, 0, 0, ...
   17  1, 3, 3, 0, 0, ...
etc.
8 has binary expansion "1000", whose runlengths are [3,1] (the length of the run in the least significant end comes first) which maps to nonordered partition {3+3} as explained in A227183, thus row 8 begins as 3, 3, 0, 0, ...
17 has binary expansion "10001", whose runlengths are [1,3,1] which maps to nonordered partition {1,3,3}, thus row 17 begins as 1, 3, 3, ...
		

Crossrefs

Only nonzero terms: A227739. Row sums: A227183. The product of nonzero terms on row n>0 is A227184(n). Number of nonzero terms on each row: A005811. The leftmost column, after n>0: A136480. The rightmost nonzero term: A227185.
Cf. A227368 and also arrays A227186 and A227188.

Programs

A227369 Positions where A227183 obtains new distinct values for the first time.

Original entry on oeis.org

0, 1, 2, 4, 5, 8, 9, 16, 17, 23, 32, 39, 40, 71, 72, 80, 87, 144, 151, 160, 167, 288, 295, 320, 327, 351, 576, 607, 640, 671, 672, 1183, 1184, 1311, 1312, 1344, 1375, 2368, 2399, 2624, 2655, 2688, 2719, 4736, 4767, 5248, 5279, 5376, 5407, 5503, 9472, 9599, 10496
Offset: 0

Views

Author

Antti Karttunen, Jul 08 2013

Keywords

Comments

Sequence A227368 sorted into ascending order.

Crossrefs

Formula

a(n) = A227370(A227368(n)). [See comments and conjectures at A227370]

A056239 If n = Product_{k >= 1} (p_k)^(c_k) where p_k is k-th prime and c_k >= 0 then a(n) = Sum_{k >= 1} k*c_k.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5, 4, 6, 5, 5, 4, 7, 5, 8, 5, 6, 6, 9, 5, 6, 7, 6, 6, 10, 6, 11, 5, 7, 8, 7, 6, 12, 9, 8, 6, 13, 7, 14, 7, 7, 10, 15, 6, 8, 7, 9, 8, 16, 7, 8, 7, 10, 11, 17, 7, 18, 12, 8, 6, 9, 8, 19, 9, 11, 8, 20, 7, 21, 13, 8, 10, 9, 9, 22, 7, 8, 14, 23, 8, 10, 15, 12, 8, 24, 8, 10
Offset: 1

Views

Author

Leroy Quet, Aug 19 2000

Keywords

Comments

A pseudo-logarithmic function in the sense that a(b*c) = a(b)+a(c) and so a(b^c) = c*a(b) and f(n) = k^a(n) is a multiplicative function. [Cf. A248692 for example.] Essentially a function from the positive integers onto the partitions of the nonnegative integers (1->0, 2->1, 3->2, 4->1+1, 5->3, 6->1+2, etc.) so each value a(n) appears A000041(a(n)) times, first with the a(n)-th prime and last with the a(n)-th power of 2. Produces triangular numbers from primorials. - Henry Bottomley, Nov 22 2001
Michael Nyvang writes (May 08 2006) that the Danish composer Karl Aage Rasmussen discovered this sequence in the 1990's: it has excellent musical properties.
All A000041(a(n)) different n's with the same value a(n) are listed in row a(n) of triangle A215366. - Alois P. Heinz, Aug 09 2012
a(n) is the sum of the parts of the partition having Heinz number n. We define the Heinz number of a partition p = [p_1, p_2, ..., p_r] as Product_{j=1..r} (p_j-th prime) (concept used by Alois P. Heinz in A215366 as an "encoding" of a partition). For example, for the partition [1, 1, 2, 4, 10] we get 2*2*3*7*29 = 2436. Example: a(33) = 7 because the partition with Heinz number 33 = 3 * 11 is [2,5]. - Emeric Deutsch, May 19 2015

Examples

			a(12) = 1*2 + 2*1 = 4, since 12 = 2^2 *3^1 = (p_1)^2 *(p_2)^1.
		

Crossrefs

Programs

  • Haskell
    a056239 n = sum $ zipWith (*) (map a049084 $ a027748_row n) (a124010_row n)
    -- Reinhard Zumkeller, Apr 27 2013
    
  • Maple
    # To get 10000 terms. First make prime table: M:=10000; pl:=array(1..M); for i from 1 to M do pl[i]:=0; od: for i from 1 to M do if ithprime(i) > M then break; fi; pl[ithprime(i)]:=i; od:
    # Decode Maple's amazing syntax for factoring integers: g:=proc(n) local e,p,t1,t2,t3,i,j,k; global pl; t1:=ifactor(n); t2:=nops(t1); if t2 = 2 and whattype(t1) <> `*` then p:=op(1,op(1,t1)); e:=op(2,t1); t3:=pl[p]*e; else
    t3:=0; for i from 1 to t2 do j:=op(i,t1); if nops(j) = 1 then e:=1; p:=op(1,j); else e:=op(2,j); p:=op(1,op(1,j)); fi; t3:=t3+pl[p]*e; od: fi; t3; end; # N. J. A. Sloane, May 10 2006
    A056239 := proc(n) add( numtheory[pi](op(1,p))*op(2,p), p = ifactors(n)[2]) ; end proc: # R. J. Mathar, Apr 20 2010
    # alternative:
    with(numtheory): a := proc (n) local B: B := proc (n) local nn, j, m: nn := op(2, ifactors(n)): for j to nops(nn) do m[j] := op(j, nn) end do: [seq(seq(pi(op(1, m[i])), q = 1 .. op(2, m[i])), i = 1 .. nops(nn))] end proc: add(B(n)[i], i = 1 .. nops(B(n))) end proc: seq(a(n), n = 1 .. 130); # Emeric Deutsch, May 19 2015
  • Mathematica
    a[1] = 0; a[2] = 1; a[p_?PrimeQ] := a[p] = PrimePi[p];
    a[n_] := a[n] = Total[#[[2]]*a[#[[1]]] & /@ FactorInteger[n]]; a /@ Range[91] (* Jean-François Alcover, May 19 2011 *)
    Table[Total[FactorInteger[n] /. {p_, c_} /; p > 0 :> PrimePi[p] c], {n, 91}] (* Michael De Vlieger, Jul 12 2017 *)
  • PARI
    A056239(n) = if(1==n,0,my(f=factor(n)); sum(i=1, #f~, f[i,2] * primepi(f[i,1]))); \\ Antti Karttunen, Oct 26 2014, edited Jan 13 2020
    
  • Python
    from sympy import primepi, factorint
    def A056239(n): return sum(primepi(p)*e for p, e in factorint(n).items()) # Chai Wah Wu, Jan 01 2023
  • Scheme
    (require 'factor) ;; Uses the function factor available in Aubrey Jaffer's SLIB Scheme library.
    (define (A056239 n) (apply + (map A049084 (factor n))))
    ;; Antti Karttunen, Oct 26 2014
    

Formula

Totally additive with a(p) = PrimePi(p), where PrimePi(n) = A000720(n).
a(n) = Sum_{k=1..A001221(n)} A049084(A027748(k))*A124010(k). - Reinhard Zumkeller, Apr 27 2013
From Antti Karttunen, Oct 11 2014: (Start)
a(n) = n - A178503(n).
a(n) = A161511(A156552(n)).
a(n) = A227183(A243354(n)).
For all n >= 0:
a(A002110(n)) = A000217(n). [Cf. Henry Bottomley's comment above.]
a(A005940(n+1)) = A161511(n).
a(A243353(n)) = A227183(n).
Also, for all n >= 1:
a(A241909(n)) = A243503(n).
a(A122111(n)) = a(n).
a(A242424(n)) = a(n).
A248692(n) = 2^a(n). (End)
a(n) < A329605(n), a(n) = A001222(A108951(n)), a(A329902(n)) = A112778(n). - Antti Karttunen, Jan 14 2020

A114994 Numbers whose binary representation has monotonically decreasing sizes of groups of zeros (including zero-length groups between adjacent ones).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Numbers whose binary representation avoids the sequences 110, 10100, 1001000, etc. Represents partitions. Start with empty partition and process each bit from left to right: if a zero, increase the size of the smallest part; if one, add a new size 1 part. This generates the partitions in Mathematica order. Can be regarded as a table with row lengths A000041(n); values 2^n <= a(m) < 2^(n+1) are in row n, representing the partitions of n. (Interpreting arbitrary binary numbers in this way generates compositions [also known as ordered partitions]; these are the compositions where the part sizes are in decreasing order of size.)
From Vladimir Shevelev, Dec 09 2013: (Start)
Every number in binary is a concatenation of parts of the form 10...0 with k>=0 zeros. For example, 5=(10)(1), 11=(10)(1)(1), 7=(1)(1)(1). Define c-multiplication [*] by adding multiplicities of parts (ordering by nonincreasing numbers of 0's). For example, 5[*]3=(10)(1)(1)(1)=23. Two numbers we call equivalent if they have the same parts with the same multiplicities. So 6~5, 12~9, 14~13~11.
The sequence lists equivalence classes of integers, choosing the minimal representative in each.
Note that, for two terms x,y we have x[*]y=y[*]x (commutativity), and for three terms x,y,z we have x[*](y[*]z)= (x[*]y)[*]z (associativity). 0 is the unit, i.e., 0[*]x=x. Moreover, one can consider different parts, i.e., {2^n} as "c-primes". Then every term is a unique "c-product" of "c-powers" of c-primes. For example, 7=(1)^3, 10=(10)^2, etc.
Further, one can naturally introduce "c-notions": c-divisor, c-divisibility, greatest common c-divisor of several numbers and least common c-multiple, Euler c-totient function (with notion of "r is c-prime to m"), etc.
Let x[+]y denote usual sum x+y in which we order parts over nonincreasing number of zeros. Then, of course, A114994 is closed over such operation. Then a(n+1) = a(n)[+]k, where k is the least number such that a(n)[+]k > a(n). For example, since a(10)=11, we have 11[+]1=9, 11[+]2=11, 11[+]3=11, 11[+]4=15>11. So, a(11)=15.
(End)

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)
		

Crossrefs

Cf. also A227739, A227183 and permutation pair A229119/A229120 for another system of encoding unordered partitions in the binary representation of n.

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

A161511 Number of 1...0 pairs in the binary representation of 2n.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5, 4, 6, 5, 6, 4, 5, 5, 6, 5, 7, 6, 7, 5, 8, 7, 8, 6, 9, 7, 8, 5, 6, 6, 7, 6, 8, 7, 8, 6, 9, 8, 9, 7, 10, 8, 9, 6, 10, 9, 10, 8, 11, 9, 10, 7, 12, 10, 11, 8, 12, 9, 10, 6, 7, 7, 8, 7, 9, 8, 9, 7, 10, 9, 10, 8, 11, 9, 10, 7, 11, 10, 11, 9, 12, 10, 11, 8, 13, 11, 12, 9, 13
Offset: 0

Views

Author

Keywords

Comments

Row (partition) sums of A125106.
a(n) is also the weight (= sum of parts) of 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

Examples

			For n = 5, the binary representation of 2n is 1010; the 1...0 pairs are 10xx, 1xx0, and xx10, so a(5) = 3.
		

Crossrefs

Cf. A000120, A243499 (gives the corresponding products), A227183, A056239, A243503, A006068, A163511.
Sum of prime indices of A005940.
Row sums of A125106.
A reverse version is A359043, row sums of A242628.
A029837 adds up standard compositions, row sums of A066099.
A029931 adds up binary indices, row sums of A048793.

Programs

  • Mathematica
    a[0] = 0; a[n_] := If[EvenQ[n], a[n/2] + DigitCount[n/2, 2, 1], a[(n-1)/2] + 1]; Array[a, 93, 0] (* Jean-François Alcover, Sep 09 2017 *)
  • PARI
    a(n)=local(t,k);t=0;k=1;while(n>0,if(n%2==0,k++,t+=k);n\=2);t
    
  • Python
    def A161511(n):
        a, b = 0, 0
        for i, j in enumerate(bin(n)[:1:-1], 1):
            if int(j):
                a += i-b
                b += 1
        return a # Chai Wah Wu, Jul 26 2023
  • Scheme
    ;; Two variants, the recursive one requiring memoizing definec-macro from Antti Karttunen's IntSeq-library.
    (define (A161511 n) (let loop ((n n) (i 1) (s 0)) (cond ((zero? n) s) ((even? n) (loop (/ n 2) (+ i 1) s)) (else (loop (/ (- n 1) 2) i (+ s i))))))
    (definec (A161511 n) (cond ((zero? n) n) ((even? n) (+ (A000120 n) (A161511 (/ n 2)))) (else (+ 1 (A161511 (/ (- n 1) 2))))))
    ;; Antti Karttunen, Jun 28 2014
    

Formula

a(0) = 0; a(2n) = a(n) + A000120(n); a(2n+1) = a(n) + 1.
From Antti Karttunen, Jun 28 2014: (Start)
Can be also obtained by mapping with an appropriate permutation from the lists of partition sizes computed for other enumerations similar to A125106:
a(n) = A227183(A006068(n)).
a(n) = A056239(A005940(n+1)).
a(n) = A243503(A163511(n)). (End)
a(n) = A029931(n) - binomial(A000120(n),2). - Gus Wiseman, Jan 03 2023
a(n) = a(n - A048896(n-1)) + 1 for n>=1 (see Peter J. Taylor link). - Mikhail Kurkov, Jul 04 2025

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

Views

Author

Antti Karttunen, May 01 2007

Keywords

Comments

This sequence is based on the fact that compositions (i.e. ordered partitions) can be mapped 1-to-1 to partitions by taking the partial sums of the list where one is subtracted from each composant except the first. (See table A227189 where the parts for each partition are listed).
The inverse process, from partitions to compositions, occurs by inserting the first (i.e. smallest) element of a partition sorted into ascending order to the front of the list obtained by adding one to the first differences of the elements.
Compositions map bijectively to nonnegative integers by assigning each run of k consecutive 1's (or 0's) in binary expansion of n with summand k in the composition.
The graph of this sequence is quite interesting.

Examples

			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.
		

Crossrefs

a(n) = A075158(A122111(1+A075157(n)) - 1). See A129595 for another kind of encoding of integer partitions.
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).
Cf. A227185 (the largest part).
Cf. A227183 (sum of parts).
Cf. A227184 (product of parts).
Note that this permutation maps between A005811 and A227185 as follows: A005811(n) = A227185(a(n)) and vice versa: A227185(n) = A005811(a(n)). On the other hand, it keeps A227183 fixed, as A227183(n) = A227183(a(n)).
Cf. also A226062.

A226062 a(n) = Bulgarian solitaire operation applied to the partition encoded in the runlengths of binary expansion of n.

Original entry on oeis.org

0, 1, 3, 2, 13, 7, 6, 6, 11, 29, 15, 58, 9, 14, 4, 14, 19, 27, 61, 54, 245, 31, 122, 52, 27, 25, 30, 50, 25, 12, 12, 30, 35, 23, 59, 46, 237, 125, 118, 44, 235, 501, 63, 1002, 233, 250, 116, 40, 51, 19, 57, 38, 229, 62, 114, 36, 59, 17, 28, 34, 57, 8, 28, 62
Offset: 0

Views

Author

Antti Karttunen, Jul 06 2013

Keywords

Comments

For this sequence the partitions are encoded in the binary expansion of n in the same way as in A129594.
In "Bulgarian solitaire" a deck of cards or another finite set of objects is divided into one or more piles, and the "Bulgarian operation" is performed by taking one card from each pile, and making a new pile of them. The question originally posed was: on what condition the resulting partitions will eventually reach a fixed point, that is, a collection of piles that will be unchanged by the operation. See Martin Gardner reference and the Wikipedia-page.
A037481 gives the fixed points of this sequence, which are numbers that encode triangular partitions: 1 + 2 + 3 + ... + n.
A227752(n) tells how many times n occurs in this sequence, and A227753 gives the terms that do not occur here.
Of further interest: among each A000041(n) numbers j_i: j1, j2, ..., jk for which A227183(j_i)=n, how many cycles occur and what is the size of the largest one? (Both are 1 when n is in A000217, as then the fixed points are the only cycles.) Cf. A185700, A188160.
Also, A123975 answers how many Garden of Eden partitions there are for the deck of size n in Bulgarian Solitaire, corresponding to values that do not occur as the terms of this sequence.

Examples

			5 has binary expansion "101", whose runlengths are [1,1,1], which are converted to nonordered partition {1+1+1}.
6 has binary expansion "110", whose runlengths are [1,2] (we scan the runs of bits from right to left), which are converted to nonordered partition {1+2}.
7 has binary expansion "111", whose list of runlengths is [3], which is converted to partition {3}.
In "Bulgarian Operation" we subtract one from each part (with 1-parts vanishing), and then add a new part of the same size as there originally were parts, so that the total sum stays same.
Thus starting from a partition encoded by 5, {1,1,1} the operation works as 1-1, 1-1, 1-1 (all three 1's vanish) but appends part 3 as there originally were three parts, thus we get a new partition {3}. Thus a(5)=7.
From the partition {3} -> 3-1 and 1, which gives a new partition {1,2}, so a(7)=6.
For partition {1+2} -> 1-1 and 2-1, thus the first part vanishes, and the second is now 1, to which we add the new part 2, as there were two parts originally, thus {1+2} stays as {1+2}, and we have reached a fixed point, a(6)=6.
		

References

  • Martin Gardner, Colossal Book of Mathematics, Chapter 34, Bulgarian Solitaire and Other Seemingly Endless Tasks, pp. 455-467, W. W. Norton & Company, 2001.

Crossrefs

Cf. A037481 (gives the fixed points).
Cf. A227752 (how many times n occurs here).
Cf. A227753 (numbers that do not occur here).
Cf. A129594 (conjugates the partitions encoded with the same system).

Formula

Other identities:
A227183(a(n)) = A227183(n). [This operation doesn't change the total sum of the partition.]
a(n) = A243354(A242424(A243353(n))).
a(n) = A075158(A243051(1+A075157(n))-1).

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

Views

Author

Antti Karttunen, Jul 25 2013

Keywords

Comments

Row n has A005811(n) elements. Each row contains a unique (unordered) partition of some integer, and all possible partitions of finite natural numbers eventually occur. The first partition that sums to k occurs at row A227368(k) and the last at row A000225(k).
Other similar tables of unordered partitions: A036036, A036037, A080576, A080577 and A112798.

Examples

			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
		

Crossrefs

Row sums: A227183, row products: A227184, the initial (smallest) term of each row: A136480, the last (largest) term: A227185.
Cf. also A227189, A227738, A227736.

Programs

  • Mathematica
    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 *)
  • Scheme
    (define (A227739 n) (A227189bi (A227737 n) (A227740 n))) ;; The Scheme-code for A227189bi has been given in A227189.

Formula

a(n) = A227189(A227737(n),A227740(n)).

A243353 Permutation of natural numbers which maps between the partitions as encoded in A227739 (binary based system, zero-based) to A112798 (prime-index based system, one-based).

Original entry on oeis.org

1, 2, 4, 3, 9, 8, 6, 5, 25, 18, 16, 27, 15, 12, 10, 7, 49, 50, 36, 75, 81, 32, 54, 125, 35, 30, 24, 45, 21, 20, 14, 11, 121, 98, 100, 147, 225, 72, 150, 245, 625, 162, 64, 243, 375, 108, 250, 343, 77, 70, 60, 105, 135, 48, 90, 175, 55, 42, 40, 63, 33, 28, 22, 13, 169, 242, 196, 363, 441, 200, 294, 605, 1225, 450, 144
Offset: 0

Views

Author

Antti Karttunen, Jun 05 2014

Keywords

Comments

Note the indexing: the domain includes zero, but the range starts from one.

Crossrefs

A243354 gives the inverse mapping.

Programs

  • Mathematica
    f[n_, i_, x_] := Which[n == 0, x, EvenQ@ n, f[n/2, i + 1, x], True, f[(n - 1)/2, i, x Prime@ i]]; Table[f[BitXor[n, Floor[n/2]], 1, 1], {n, 0, 74}] (* Michael De Vlieger, May 09 2017 *)
  • Python
    from sympy import prime
    import math
    def A(n): return n - 2**int(math.floor(math.log(n, 2)))
    def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n))
    def a005940(n): return b(n - 1)
    def a003188(n): return n^int(n/2)
    def a243353(n): return a005940(1 + a003188(n)) # Indranil Ghosh, May 07 2017
  • Scheme
    (define (A243353 n) (A005940 (+ 1 (A003188 n))))
    

Formula

a(n) = A005940(1+A003188(n)).
a(n) = A241909(1+A075157(n)). [With A075157's original starting offset]
For all n >= 0, A243354(a(n)) = n.
A227183(n) = A056239(a(n)). [Maps between the corresponding sums ...]
A227184(n) = A003963(a(n)). [... and products of parts of each partition].
For n >= 0, a(A037481(n)) = A002110(n). [Also "triangular partitions", the fixed points of Bulgarian solitaire, A226062 & A242424].
For n >= 1, a(A227451(n+1)) = 4*A243054(n).
Showing 1-10 of 22 results. Next