Partition prime list into equal k sublists. How to write code for

• To: mathgroup at smc.vnet.net
• Subject: [mg107000] Partition prime list into equal k sublists. How to write code for
• From: a boy <a.dozy.boy at gmail.com>
• Date: Sun, 31 Jan 2010 05:57:05 -0500 (EST)

```Suppose p[i] is the i-th prime,  P[n]={p[i]| 1<=i<=n}. Since the only even
prime is 2, the summary of P[n] is even iff n is odd.

Conjecture: When n=2m+1 is odd, prime list P[n] can be partitioned into 2
non-overlapping sublists , each sublist has equal summary Total[P[n]]/2;
When n=2m is even, prime list P[n] can be partitioned into 2 non-overlapping
sublists , one sublist's summary  is (Total[P[n]]-1)/2, the other's is
(Total[P[n]]+1)/2.

k = 2;
Manipulate[P[n] = list = Prime[Range[1, n]];
Print[sum = Total[list]/k];
Select[Subsets[list, {(n - 1)/2}], Total[#] == sum &],
{n, 3, 21, 2}]

n=10, P[10]=Prime[Range[1, 10]] can be partitioned into equal 3 sublists.
43=129/3=3+11+29=7+13+23=2+ 5+17+ 19
Question: when prime list can be partitioned into equal 3 sublists? only if
Total[P[n]]/3 is an integer?

n = 20
FoldList[Plus, 0, Prime[Range[1, n]]]
k = 3;
n = 10;
P[n] = list = Prime[Range[1, n]]
sum = Total[list]/k
Select[Subsets[list, {2, (n - 1)}], Total[#] == sum &]

These codes is not good for solving this question. Can you help me?

```

• Prev by Date: Re: Problem with ContourPlot3D
• Next by Date: Re: position of sequence of numbers in list