Divide a set of 24 integers from 2 to 25 inclusively, with each of the integers occurring precisely once, into two mutually exclusive groups such that the absolute difference between the product of the integers in each group is the minimum.
We need to get as close as possible to the square root of 25!
This program seeks that, with prime factors under 25:
5 dim Ct(9)
10 N=int(sqrt(!(25)))
20 repeat
30 Dvr=2:N1=N:for I=1 to 9:Ct(I)=0:next:Sb=1
35 repeat
40 repeat
50 if N1@Dvr=0 then N1=N1//Dvr:Ct(Sb)=Ct(Sb)+1
60 until N1@Dvr>0
70 Dvr=nxtprm(Dvr):Sb=Sb+1
80 until Dvr>25
90 if N1=1 then print N
100 N=N-1
110 until N=1
The list of such numbers with prime factors under 25, in decreasing order from sqrt(25!) are:
3938416003200
3938401958400
3938386192884
3938371937500
3938317142760
3938310926550
3938298938145
3938287878144
3938284980630
3938278960000
3938264730400
3938264064000 *** see below
3938250129408
3938240250000
3938220000000
3938214560000
3938202734375
3938188800000
3938180103000
3938168447070
3938158806120
3938153551488
3938134007808
3938128458264
3938116742560
3938107357184
3938078289600
3938076562500
3938074513065
3937998920625
The first one on the list that's workable (with prime factors combinable into unique numbers under 26) is 3938264064000, which factors into
2*2*2*2*2*2*2*2*2*2*2*2*2*3*3*3*3*3*5*5*5*7*7*17*19
which can then be recombined into
2*3*4*5*6*7*8*9*10*12*14*17*19*20
The remaining integers constitute the other group:
11*13*15*16*18*21*22*23*24*25 = 3938590656000
|
Posted by Charlie
on 2009-11-24 16:28:04 |