# Questions tagged [partitions]

this tag is used for questions regarding splitting a list into sublists

170 questions
Filter by
Sorted by
Tagged with
510 views

### What is a simple way to copy a partition from one list to another list?

I have two lists of the same length at their bottom level and one contains sublists of various lengths: A={{1,2,3},{4,5,6,7},{8,9}}; B={a,b,c,d,e,f,g,h,i}; Is ...
• 393
232 views

### Partitioning a list based on the count of a certain marker

My goal is to get lists containing k number of 0.1s. For example, in ...
• 648
154 views

### PartitionsP for non-integer arguments [closed]

Is there a reason why the function PartitionsP[] does not return anything for non-integer arguments, although there is a way to calculate using Rademacher’s ‘exact’ ...
• 3
49 views

### NextSetPartition

I'm looking for a function similar to the one in the question below, but for the more general problem of set partitions without restricting the set size. NextKSizePartition, or how to partition a set ...
• 159
61 views

### Creating function with array input with desired coefficient and evaluate it

I had asked the same question before here Creating a list of functions with desired coefficients but did not get the desired answer, may be I was not clear in my question. I have defined this function ...
• 219
94 views

### Creating a list of functions with desired coefficients

I have defined this function to results some list of functions, however its not returning what I want ...
• 219
635 views

### Better code for Ramsey partitions

Ramsey partitions for parameters $a$ and $b$ are certain integer partition of $a+b$ developed by McAvaney, Robertson, and Webb (Combinatorica 1992) for applications in fair division problems where two ...
171 views

### Two simple vector partition rules

We have a vector of zeros and other numbers, f.e: vector = {0, 0, 0, 9, 0, 2, 0, 5, 0, 4, 0, 5, 6, 2, 0}; The two rules: Partition the vector in such a way that (1)...
• 82.3k
166 views

### How to make a function that returns all super distinct partitions?

I am working on distinct partitions. I recently created a function StrictIntegerPartitions. This is from the book Integer Partitions by George E. Andrews at Pennsylvania State University and Kimmo ...
• 1,725
747 views

### Design a function that gives all strict partitions of an integer

A strict partition of an integer has all distinct parts. There are no duplicates like 1 in {5,3,1,1} for 10. All the parts are unique. Sylvester created a bijection between the partitions of an ...
• 1,725
47 views

### code for Garsia-Milne bijection

The combinatorial interpretation of the first Rogers-Ramanujan identity states that the partitions of n with gaps at least two between parts and the partitions of n with parts that are either 1 or 4 ...
1 vote
106 views

### Splitting the List

I want to split a list. There is one set of list with two {x,{a,b}} elements. it's like ...
• 446
234 views

### Partition of lists with specified elements

I have an array like this and want to split it into sublists. It should contain the first element "Res" without curly braces and the one sublist starts from 2 to the 9th column the 3rd ...
• 73
95 views

### Partion of lists

I have a list like this and want to split it into three sublists. One should contain only the first element the 2nd should contain 8 elements starting from 1.944 to 11 and the third should start from ...
• 73
1 vote
62 views

I am using v12.2.0 on Win7-x64. The difference between case 1 and case 2 is that the list being partitioned has 5 elements vs 4 ...
• 56.1k
384 views

### Writing a number 'm' as a sum of 'n' prime numbers

We can write {2 = 2}, {3 = 2+1, 3 = 3}, {4 = 2+2, 4 = 3+1}, {5 = 3+2, 5 = 2+2+1}, {6 = 3+3, 6 = 5+1, 6 = 3+2+1} and so on. I am trying to write every positive integer as a sum of Prime numbers. In ...
• 145
75 views

### Unwanted behavior with List Partition function in which it strips out Iconized elements of Rules [closed]

The goal is to output a Grid of sorted columns of Rule elements that are Iconize-d. The <...
• 2,467
131 views

### Counting number of (non distinct) integer partitions into k

I want to count and generate the number of non distinct integer partitions into k. I know that IntegerPartitions[n,{k}] returns the partitions of integer n into k. E.g. IntegerPartitions[4, {2}] ...
• 23
524 views

### Sum indexed over set

Say I have sets = {{a,b},{c,d},{e,f}} and I want to compute a sum like f[a,b] + f[c,d] + f[e,f]. One way to do this is to do <...
1 vote
93 views

### KSetPartitions function with fixed points

I'm trying to develop a function that computes some numerators for scattering amplitudes and I need to generate a collection of tree diagrams that contain a set of particles (effectively numbers) <...
• 259
158 views

### Partition of the long list

I am trying to do the partition of the list variable called test so that answer will look like the variable called goal. The test list is actually a list of long data. In this example I have a short ...
• 893
80 views

### Double partition of list

Partition can have lots of different arguments so I am curious whether the following results can be achieved using single ...
• 20.3k
334 views

### Regular grid of points in arbitrary dimensions

Is there an efficient way to output a collection of equally spaced points in Mathematica, in arbitrary dimensions? In 1D there is the Range function, which given ...
• 253
128 views

### Partition the list by group of Arithmetic Progression

I have a list= {4, 8, 10, 11, 12, 14, 16, 7, 9} How can i partition the list by group of Arithmetic Progression with common difference 1 : {{4}, {8}, { 10, 11, 12}, {14}, {16}, {7}, {9}}
• 804
2k views

### Partitioning a list based on a criterion for sublists

SeedRandom[1]; alist = RandomInteger[{1, 10}, 20] {2, 5, 1, 8, 1, 1, 9, 7, 1, 5, 2, 9, 6, 2, 2, 2, 4, 3, 2, 7} I would like to divide this list into sublists (...
• 56.1k
71 views

### Choosing numbers whose divisors can be partitioned into subsets having the equal sum

How can we find the list of natural numbers between 100 to 10000, whose positive divisors can be partitioned into three subsets such that sum of all the elements in three subsets will be equal?
223 views

### Choosing a subset of a set based on the sum of its elements

How can we choose a subset of a set based on the sum of the elements of the subset? For instance, n=6 dn=Divisors[n] sn=DivisorSum[n,#&] Is it possible to ...
• 41
59 views

### Assign different type of balls into output containers with constraints

The problem is to asssign all differend kind inputs to outputs. For example colored balls. On the input we can receive max 5 different type of colored balls any with amount. The amounts for the inputs ...
2k views

### How to split a number

I have a number representing date (yyyymmdd): 19001231 I want to convert this number to {1900,12,31} How to do this? There ...
313 views

### Dividing a list into $n$ non-overlapping pieces?

Is there a function that gives all the ways a list can be divided into a specified number of non-overlapping pieces, where the order is maintained? I can do this with ...
• 3,643
324 views

### Finding all partitions (2 elements per subset) of a set composed of an even number of elements

I'd like to find all the partitions (each subset of a partition should contain 2 elements) of a set composed by an even number of elements. For example, given $A=\lbrace 1,2,3,4,5,6 \rbrace$, I'd like ...
168 views

### Mathematica code for q-Stirling numbers

In the paper [A new $q$-Analog of Stirling Numbers],(https://hal.archives-ouvertes.fr/hal-01372920/document)[PDF] J. Cigler defined $q$-Stirling numbers of the second kind as the following: He ...
• 143
119 views

### Finding IntegerPartitions[252] with no zero and no duplicates

Well, I am trying to execute the following code: ...
• 2,021
1 vote
88 views

### Plotting parts of a polynomial

Bug introduced in 12.2 or earlier and persisting through 13.2 or later Consider the following polynomial fun = 2 x + 34 x^2 - 5 y + 4 y^3; when I try ...
• 1,278
145 views

### Draw partition of 3D polygon

I want to draw a partition of an arbitrary 3D polyhedron like this drawing. Where can I find examples of how to draw this? Upd: For example, I have this code on python ...
• 21
306 views

### Understanding Partition

I came across the difficulty of understanding the logic of interaction of the fourth and fifth arguments of Partition. Here is an example: ...
1 vote
91 views

### Decompose expression into specified form of partial fractions

In order to obtain the partial fractions of an expression, I used the function Apart to realize it. However the result is shown as Figure 1 which isn't what I want. ...
• 693
58 views

### P=QRS decomposition of given list -2 -unordered list

This is an extended version of my previous post, $P=QRS$ decomposition of given list Based on the answer and comment of @Bill, Form all permutations of P. Form Q as the first element of each of those,...
• 923
92 views

### Enumerate all possible subsets such that all are of the same length which is maximum and each contains non-repeating elements?

Given a list lists: ...
• 1,648
385 views

### Partition a nested list such that no repeated elements in every subsets?

I have a large list and for simplicity, let's take the simple list as an example: lists = {{1, 2}, {1, 6}, {2, 3}, {2, 5}, {3, 4}, {3, 6}, {4, 5}, {5, 6}} I would ...
• 1,648
96 views

### Weighted partitions of a matrix

***Made an important edit to make the "partition" part of the question more clear Let $m,n$ be positive integers. Denote $\left[ m\right] \equiv \{ 1,\ldots ,m\}$. Let \mathbf{w} \equiv \...
148 views

### How to get the complete list of subsets the pairwise intersections of which are empty

Given the list Range[4]. I want to get the sublists of length 2 where each element has length 2 and the pairwise intersections are empty. So I am looking for: ...
• 2,788
64 views

### Unknown statistical function - groupings of permutations

Please bear with the vagueness of this question's title, as my question itself has to deal with the fact that I don't know what to call the operation I'm looking for. I have a statistical operation ...
• 645
103 views

### Summing list elements for given index tuple

Is there a more compact way of summing certain elements of lists together when given a tuple of which elements to sum. For example if I am given the list of size 8: ...
• 271
113 views

### Splitting balls over sized bins

This is strongly related to Splitting a set of integers over a set of bins, but a much simpler case. If we have $N$ indistinguishable balls and $k$ arbitrarily large distinguishable bins, we know the ...
• 47k
127 views

### Splitting a set of integers over a set of bins

I have a problem that feels like it should be simple but I'm just drawing a blank on. I've got a set of integers, e.g. ...
• 47k
639 views

### Scan through (partial) tuples

I have a list of list of positive integers $s = \{s_1, s_2, ..., s_k\}$, each list $s_i$ is possibly of different lengths, and I want to find out if there exists a $k$-tuple of the $s_i$ that sums ...
• 47.1k
241 views

### Partitioning a list to several depths

I an aware of the Partition command which partitions a list into sublists. I'm curious as to whether there is an efficient way to partition a list several times ...
• 1,043