# Get the partition number

1. Apr 16, 2013

### xeon123

I've a set of $N$ numbers with n size, and I want to find to each partition they belong. E.g., a set with numbers from 1 to 210, with 3 partitions. So, the numbers from 1 to 70 goes to partition 1, from 71 to 140 goes to partition 2, and from 141 to 210 goes to partition 3. How can I calculate this?

Thanks,

2. Apr 16, 2013

### HallsofIvy

A "partition" of a set is any collection of subsets such that each member of the set belongs to one and only one of the subsets. But you seem to be thinking of something much more specific- you want a partition in which every subset (except possibly one) contains a sequence of numbers from the set: 1 to m, in one subset, m+1 to 2m in another, etc. Is that correct?

In that case it is very simple: to partition a set with n members into m such subsets:
1) if m evenly divides n, as in the example given, there will be n/m subsets, the first containing 1 through m, the second m+1 through 2m, etc. n That is, the kth subset contains (k-1)m+ 1 through km.

2) if m does not evenly divide m, let $\lfloor n/m\rfloor$ be the largest integer less than or equal to m/n. There will be $\lfloor n/m\rfloor$ subsets containing exactly m members of the set, again, the kth such subset containing (k-1)m+1 through km, and one additional set with only the last $n- m\lfloor n/m\rfloor$ members.

3. Apr 16, 2013

### xeon123

But I want the an equation that gives me the partition number. E.g.,
1*(something)=1
2*(something)=1
...
69*(something)=1
70*(something)=1
71*(something)=2
...
139*(something)=2
140*(something)=2
141*(something)=3
...
210*(something)=3

4. Apr 16, 2013

### xeon123

I think the solution is:

If I put the values in a matrix, row 0 goes from 1 to m, row1 goes from m+1 to 2m, etc... So let me define the variables,
n is a number from 1 to 210
i is the number of the column
j is the number of the row
m is the number of partitions
p is the size of the partition (n/m)

So, n=i*p+j

Is it correct?

5. Apr 16, 2013

### Staff: Mentor

Here's a slight variation on your setup. Instead of the integers 1, 2, ..., 210, let's say you have 0, 1, 2, ..., 209. You still have 210 numbers. Also, instead of having partition 1, 2, and 3, let's number them 0, 1, and 2.

The first partition will be 0, 1, ..., 69
The second will be 70, 71, ..., 139
The third will be 140, 141, ..., 209

If N is a number in your list, then INT(N/70) will evaluate to 0, 1, or 2, with INT being a function in Excel and other spreadsheets.
Some examples.
1. N = 37
INT(37/70) = 0

2. N = 75
INT(75/70) = 1

3. N = 70
INT(70/70) = 1

4. N = 208
INT(208/70) = 2