52 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
2
answers
207
views
What is a faster way to find all unique partitions of an integer and their weights?
I have seen loads of posts on this topic, but none are exactly what I am looking for.
I want to find all ways a positive integer N that is greater than 1 can be expressed as the sum of at most N ...
0
votes
2
answers
252
views
How to generate random numbers that roughly follow a normal distribution that also add up to a specific total?
I'm trying to generate a random set of numbers that add up to a specific total, and a specific maximum value that the numbers can reach.
However each approach I seem to have come across have some flaw ...
3
votes
2
answers
75
views
Nested partitions of integers
I want to create all nested partitions of an integer - with all possible permutations of numbers and brackets (nests) at all possible positions.
For example, for n = 3, I would like to have
(3,)
(1, 2)...
2
votes
1
answer
130
views
Check if a set of numbers can be produced by continuously halving a single starting number
Given a set of numbers, I want to check if it is possible to produce the full set of numbers by repeatedly splitting one single starting number into its halves and doing the same for each of the ...
1
vote
2
answers
205
views
Uniformly randomly generate a vector of k unsigned ints that sums to N
Another phrasing is: randomly partition N identical items into k buckets, allowing some buckets to be empty.
For this discussion:
an "integer partition of N", to match the usual definition ...
0
votes
0
answers
401
views
Airflow BigQueryInsertJobOperator: how to create partitioned table?
I have a simple DAG, where I am calling BigQueryInsertJobOperator Is there any way to create a partitioned table?
article= BigQueryInsertJobOperator(
task_id="article",
...
1
vote
1
answer
247
views
Number of integer partitioning into exactly k parts (calculating for large integer )
Following this thread python-integer-partitioning-with-given-k-partitions
I want to find the number of such partitions (where the minimum part is equal to 1), but the following solution (in the thread ...
4
votes
3
answers
202
views
Rank of Partition with specific length
How can I determine the rank/index of a partition of integer n with length k?
For instance, if n=10 and k=3, the possible partitions (sorted in reverse lexicographic order) are:
0 (8, 1, 1)
1 (7, 2, 1)...
0
votes
1
answer
134
views
Integer partition N into M parts in parallel
I am trying to randomly generate integer partitions (N into M parts) in pytorch with a minimum partition size of 1.
For example, (3, 1, 1) and (4, 1, 0) are both partitions of 5 into 3 parts but (4, 1,...
1
vote
0
answers
173
views
Partitioning algorithm for a list of lists in Python
I'm working on a music related problem and I need some help with a crucial step.
I have four lists of numbers from 0 to 11 (including). These lists are to be thought of as vertically aligned. I want ...
1
vote
1
answer
119
views
Randomly sampling integer partitions (without restriction on number of parts)
I have an integer N and I wish to generate one of its possible partitions uniformly at random. For example, N=5 has 7 partitions:
(5) - K=1 part
(4, 1) - K=2 parts
(3, 2) - K=2 parts
(3, 1, 1) - K=3 ...
1
vote
0
answers
89
views
Turning a Python generator into a C function
I am trying to translate a Python generator into a function in C. If it's worth mentioning, I'm trying to write a program that partitions an integer n, into l distinct parts. I believe that I've got ...
4
votes
3
answers
829
views
Optimize: Restricted integer partioning with max value
with the following code, I count the restricted integer partitions(each number can only occure once in each partition) with k numbers in each partition, each number is equal or greater than 1 and not ...
2
votes
2
answers
755
views
Count integer partions with k parts, each below some threshold m
I want to count the number of ways we can partition the number n, into k distinct parts where each part is not larger than m.
For k := 2 i have following algorithm:
public int calcIntegerPartition(int ...
1
vote
2
answers
525
views
Algorithm to find some rows from a matrix, whose sum is equal to a given row
For example, here is a matrix:
[1, 0, 0, 0],
[1, 1, 0, 0],
[1, 0, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 1],
I want to find some rows, whose sum is equal to [4, 3, 2, 1].
The expected answer is rows: {0,1,3,...