A238965 Duplicate of A036042.
0, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8
Offset: 0
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.
First six rows are: [[1]]; [[1, 1], [2]]; [[1, 1, 1], [1, 2], [3]]; [[1, 1, 1, 1], [1, 1, 2], [1, 3], [2, 2], [4]]; [[1, 1, 1, 1, 1], [1, 1, 1, 2], [1, 1, 3], [1, 2, 2], [1, 4], [2, 3], [5]]; [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 2], [1, 1, 1, 3], [1, 1, 2, 2], [1, 1, 4], [1, 2, 3], [1, 5], [2, 2, 2], [2, 4], [3, 3], [6]]; ... From _Omar E. Pol_, Sep 03 2013: (Start) Illustration of initial terms: ---------------------------------- . Ordered n j Diagram partition j ---------------------------------- . _ 1 1 |_| 1; . _ _ 2 1 | |_| 1, 1, 2 2 |_ _| 2; . _ _ _ 3 1 | | |_| 1, 1, 1, 3 2 | |_ _| 1, 2, 3 3 |_ _ _| 3; . _ _ _ _ 4 1 | | | |_| 1, 1, 1, 1, 4 2 | | |_ _| 1, 1, 2, 4 3 | |_ _ _| 1, 3, 4 4 | |_ _| 2, 2, 4 5 |_ _ _ _| 4; ... (End)
T:= proc(n) local b, ll; b:= proc(n,l) if n=0 then ll:= ll, l[] else seq(b(n-i, [l[], i]), i=`if`(l=[],1,l[-1])..n) fi end; ll:= NULL; b(n, []); ll end: seq(T(n), n=1..8); # Alois P. Heinz, Jul 16 2011
T[n0_] := Module[{b, ll}, b[n_, l_] := If[n == 0, ll = Join[ll, l], Table[ b[n - i, Append[l, i]], {i, If[l == {}, 1, l[[-1]]], n}]]; ll = {}; b[n0, {}]; ll]; Table[T[n], {n, 1, 8}] // Flatten (* Jean-François Alcover, Aug 05 2015, after Alois P. Heinz *) Table[DeleteCases[Sort@PadRight[Reverse /@ IntegerPartitions[n]], x_ /; x == 0, 2], {n, 7}] // Flatten (* Robert Price, May 18 2020 *)
t = [[[]]] for n in range(1, 10): p = [] for minp in range(1, n): p += [[minp] + pp for pp in t[n-minp] if min(pp) >= minp] t.append(p + [[n]]) print(t) # Andrey Zabolotskiy, Oct 18 2019
0; 1; 1, 2; 1, 2, 3; 1, 2, 2, 3, 4; 1, 2, 2, 3, 3, 4, 5; 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 6; 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 7;
with(combinat): nmax:=9: for n from 1 to nmax do y(n):=numbpart(n): P(n):=sort(partition(n)): for k from 1 to y(n) do B(k) := P(n)[k] od: for k from 1 to y(n) do s:=0: j:=0: while sJohannes W. Meijer, Jun 21 2010, revised Nov 29 2012 # alternative implementation based on A119441 by R. J. Mathar, Jul 12 2013 A036043 := proc(n,k) local pi; pi := ASPrts(n)[k] ; nops(pi) ; end proc: for n from 1 to 10 do for k from 1 to A000041(n) do printf("%d,",A036043(n,k)) ; end do: printf("\n") ; end do:
Table[Length/@Sort[IntegerPartitions[n]],{n,0,30}] (* Gus Wiseman, May 22 2020 *)
A036043(n,k)=#partitions(n)[k] \\ M. F. Hasler, Jun 06 2018
def A036043_row(n): return [len(p) for k in (0..n) for p in Partitions(n, length=k)] for n in (0..10): print(A036043_row(n)) # Peter Luschny, Nov 02 2019
a(22) = 25 = prime(3)^2 because the 22nd partition in A-St order is the 2-part partition (3,3) of N = 6, because A026905(5) = 18 < 22 <= A026905(6) = 29. a(23) = 28 = prime(1)^2*prime(4) corresponds to the partition 1+1+4 = 4+1+1 with three parts, also of N = 6. From _Gus Wiseman_, May 20 2020: (Start) Triangle begins: 1 2 3 4 5 6 8 7 10 9 12 16 11 14 15 20 18 24 32 13 22 21 25 28 30 27 40 36 48 64 17 26 33 35 44 42 50 45 56 60 54 80 72 96 128 As a triangle of reversed partitions we have: 0 (1) (2)(11) (3)(12)(111) (4)(13)(22)(112)(1111) (5)(14)(23)(113)(122)(1112)(11111) (6)(15)(24)(33)(114)(123)(222)(1113)(1122)(11112)(111111) (End)
Join@@Table[Times@@Prime/@#&/@Sort[Reverse/@IntegerPartitions[n]],{n,0,8}] (* Gus Wiseman, May 21 2020 *)
A185974_row(n)=[vecprod([prime(i)|i<-p])|p<-partitions(n)] \\ below a helper function: index_of_partition(n)={for(r=0, oo, my(c = numbpart(r)); n >= c || return([r,n+1]); n -= c)} /* A185974(n,k), 1 <= k <= A000041(n), gives the k-th partition of n >= 0; if k is omitted, A185974(n) return the term of index n of the flattened sequence a(n >= 0). This function is used in other sequences (such as A122172) which need to access the n-th partition as listed in A-S order. */ A185974(n, k=index_of_partition(n))=A185974_row(iferr(k[1], E, k=[k,k]; n))[k[2]] \\ (End)
The array is a tree structure as described by A128628. If a node value has only one branch the value is twice that of its parent node. If it has two branches one is twice that of its parent node but the other is defined as indicated below: (1) pick an odd number (e.g., 135) (2) calculate its prime factorization (135 = 5*3*3*3) (3) note the least prime factor (LPF(135) = 3) (4) note the index of the LPF (index(3) = 2) (5) subtract one from the index (2-1 = 1) (6) calculate the prime associated with the value in step five (prime(1) = 2) (7) The parent node of the odd number 135 is (2/3)*135 = 90 = A252461(135). From _Daniel Forgues_, Aug 07 2018: (Start) Partitions of 4 in graded reverse lexicographic order: {4}: p_4 = 7; {3,1}: p_3 * p_1 = 5 * 2 = 10; {2,2}: p_2 * p_2 = 3^2 = 9; {2,1,1}: p_2 * p_1 * p_1 = 3 * 2^2 = 12; {1,1,1,1}: p_1 * p_1 * p_1 * p_1 = 2^4 = 16. (End) From _Gus Wiseman_, May 19 2020: (Start) The sequence together with the corresponding partitions begins: 1: () 24: (2,1,1,1) 35: (4,3) 2: (1) 32: (1,1,1,1,1) 42: (4,2,1) 3: (2) 13: (6) 56: (4,1,1,1) 4: (1,1) 22: (5,1) 50: (3,3,1) 5: (3) 21: (4,2) 45: (3,2,2) 6: (2,1) 28: (4,1,1) 60: (3,2,1,1) 8: (1,1,1) 25: (3,3) 80: (3,1,1,1,1) 7: (4) 30: (3,2,1) 54: (2,2,2,1) 10: (3,1) 40: (3,1,1,1) 72: (2,2,1,1,1) 9: (2,2) 27: (2,2,2) 96: (2,1,1,1,1,1) 12: (2,1,1) 36: (2,2,1,1) 128: (1,1,1,1,1,1,1) 16: (1,1,1,1) 48: (2,1,1,1,1) 19: (8) 11: (5) 64: (1,1,1,1,1,1) 34: (7,1) 14: (4,1) 17: (7) 39: (6,2) 15: (3,2) 26: (6,1) 52: (6,1,1) 20: (3,1,1) 33: (5,2) 55: (5,3) 18: (2,2,1) 44: (5,1,1) 66: (5,2,1) (End)
b:= (n, i)-> `if`(n=0 or i=1, [2^n], [map(x-> x*ithprime(i), b(n-i, min(n-i, i)))[], b(n, i-1)[]]): T:= n-> b(n$2)[]: seq(T(n), n=0..10); # Alois P. Heinz, Feb 14 2020
Array[Times @@ # & /@ Prime@ IntegerPartitions@ # &, 9, 0] // Flatten (* Michael De Vlieger, Aug 07 2018 *) b[n_, i_] := b[n, i] = If[n == 0 || i == 1, {2^n}, Join[(# Prime[i]&) /@ b[n - i, Min[n - i, i]], b[n, i - 1]]]; T[n_] := b[n, n]; T /@ Range[0, 10] // Flatten (* Jean-François Alcover, May 21 2021, after Alois P. Heinz *)
Illustration of initial terms: --------------------------------- . Ordered n j Diagram partition --------------------------------- . _ 1 1 |_| 1; . _ _ 2 1 | _| 2, 2 2 |_|_| 1, 1; . _ _ _ 3 1 | _ _| 3, 3 2 | | _| 1, 2, 3 3 |_|_|_| 1, 1, 1; . _ _ _ _ 4 1 | _ _| 4, 4 2 | _|_ _| 2, 2, 4 3 | | _ _| 1, 3, 4 4 | | | _| 1, 1, 2, 4 5 |_|_|_|_| 1, 1, 1, 1; . Triangle begins: [1]; [2],[1,1]; [3],[1,2],[1,1,1]; [4],[2,2],[1,3],[1,1,2],[1,1,1,1]; [5],[2,3],[1,4],[1,2,2],[1,1,3],[1,1,1,2],[1,1,1,1,1]; [6],[3,3],[2,4],[2,2,2],[1,5],[1,2,3],[1,1,4],[1,1,2,2],[1,1,1,3],[1,1,1,1,2],[1,1,1,1,1,1]; [7],[3,4],[2,5],[2,2,3],[1,6],[1,3,3],[1,2,4],[1,2,2,2],[1,1,5],[1,1,2,3],[1,1,1,4],[1,1,1,2,2],[1,1,1,1,3],[1,1,1,1,1,2],[1,1,1,1,1,1,1]; ...
revlexsort[f_,c_]:=OrderedQ[PadRight[{c,f}]]; Join@@Table[Sort[Reverse/@IntegerPartitions[n],revlexsort],{n,0,8}] (* Gus Wiseman, May 23 2020 *)
Rows: [0]; [1]; [2,1]; [3,2,1]; [4,3,2,2,1]; [5,4,3,3,2,2,1]; ...
with(combinat): nmax:=9: for n from 1 to nmax do y(n):=numbpart(n): P(n):=partition(n): for k from 1 to y(n) do B(k):=P(n)[k] od: for k from 1 to y(n) do s:=0: j:=0: while sJohannes W. Meijer, Jun 21 2010
Table[If[n==0,{0},Max/@Sort[Reverse/@IntegerPartitions[n]]],{n,0,8}] (* Gus Wiseman, May 21 2020 *)
A049085(n,k)=if(n,partitions(n)[k][1],0) \\ M. F. Hasler, Jun 06 2018
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)
The table begins: 1.2.4..8.16.32.64.128.256.512.1024 ..3.5..9.17.33.65.129.257.513.1025 .......6.10.18.34..66.130.258..514 ....7.11.19.35.67.131.259.515.1027 ............12.20..36..68.132..260 .........13.21.37..69.133.261..517 ............14.22..38..70.134..262 ......15.23.39.71.135.263.519.1031 ...................24..40..72..136 ...............25..41..73.137..265 ...................26..42..74..138 ............27.43..75.139.267..523 .......................28..44...76 ...............29..45..77.141..269 ...................30..46..78..142 .........31.47.79.143.271.527.1039 ...........................48...80 .......................49..81..145 ...........................50...82 ...................51..83.147..275 This can be viewed as an irregular table, where row r (>= 1) has A000041(r) elements, that is, as 1; 2,3; 4,5,7; 8,9,6,11,15; 16,17,10,19,13,23,31; etc. A125106 illustrates how each number is mapped to a partition.
columns = 9; row[n_] := n - 2^Floor[Log2[n]]; col[0] = 0; col[n_] := If[EvenQ[n], col[n/2] + DigitCount[n/2, 2, 1], col[(n - 1)/2] + 1]; Clear[T]; T[, ] = 0; Do[T[row[k], col[k]] = k, {k, 1, 2^columns}]; Table[DeleteCases[Table[T[n - 1, k], {n, 1, 2^(k - 1)}], 0], {k, 1, columns}] // Flatten (* Jean-François Alcover, Sep 09 2017 *)
Triangle T(n,k) begins: 0; 1; 1, 2; 1, 2, 3; 1, 2, 2, 3, 4; 1, 2, 2, 3, 3, 4, 5; 1, 2, 2, 3, 2, 3, 4, 3, 4, 5, 6; ...
o:= proc(n) option remember; nops(ifactors(n)[2]) end: b:= (n, i)-> `if`(n=0 or i=1, [[1$n]], [map(x-> [i, x[]], b(n-i, min(n-i, i)))[], b(n, i-1)[]]): T:= n-> map(x-> o(mul(ithprime(i)^x[i], i=1..nops(x))), b(n$2))[]: seq(T(n), n=0..9); # Alois P. Heinz, Mar 26 2020
revlexsort[f_,c_]:=OrderedQ[PadRight[{c,f}]]; Table[Length/@Sort[IntegerPartitions[n],revlexsort],{n,0,8}] (* Gus Wiseman, May 24 2020 *) b[n_, i_] := b[n, i] = If[n == 0 || i == 1, {Table[1, {n}]}, Join[ Prepend[#, i]& /@ b[n - i, Min[n - i, i]], b[n, i - 1]]]; P[n_] := P[n] = Product[Prime[i]^#[[i]], {i, 1, Length[#]}]& /@ b[n, n]; T[n_, k_] := PrimeNu[P[n][[k + 1]]]; Table[T[n, k], {n, 0, 9}, {k, 0, Length[P[n]] - 1}] // Flatten (* Jean-François Alcover, Jan 03 2022, after Alois P. Heinz in A063008 *)
Row(n)={apply(s->#s, vecsort([Vecrev(p) | p<-partitions(n)], , 4))} { for(n=0, 8, print(Row(n))) } \\ Andrew Howroyd, Mar 25 2020
Comments