![]() |
|
|
#1 |
|
Jan 2010
2·43 Posts |
Good Time to All, Amici.
i got following math problem: to split up number array into pairs of arrays where X[t] & Y[t] are multiplications of numbers of gotten arrays (in t'th pair) with condition: |X(0)-Y(0)|==MIN(0), |MIN(0)-(X(1)-Y(1))|==MIN(1), ..., |MIN(n-1)-(X(n)-Y(n))|==MIN(n). for example, let's take an array: 2, 5, 7 then: first pair is {2, 5}, {7} ==> X(0)==2*5==10, Y(0)==7, MIN(0)==3; second is {2, 7}, {5} ==> X(0)==14, Y(0)==5, MIN(1)==6; third is .. ------------------------------------------------ Thanks a lot in Advance. Last fiddled with by SarK0Y on 2010-03-08 at 00:01 |
|
|
|
|
|
#2 | |
|
Jul 2006
Calgary
52×17 Posts |
Quote:
Your example doesn't match the description either, you seem to say X[t] and Y[t] are multiplications of pairs but your example the Y is not any multiplication of any pair. You should call the MIN function something else. MIN is conventionally the MINIMUM function and will cause confusion. Is this a school math problem? It should be in the homework help section. Not the main math section. |
|
|
|
|
|
|
#3 | ||
|
Jan 2010
10101102 Posts |
lfm
Quote:
Quote:
Last fiddled with by SarK0Y on 2010-03-08 at 17:54 |
||
|
|
|
|
|
#4 | ||
|
"Richard B. Woods"
Aug 2002
Wisconsin USA
22·3·641 Posts |
Quote:
I'm not sure how to translate all your other notations into terms I'm familiar with, but let me ask about some possibilities: Start with same "original array" as in your example: {3, 11, 23, 31, 37} Is that intended to be a well ordered set ( as in http://mathworld.wolfram.com/WellOrderedSet.html ) ? One partition of that set is: {3, 11, 31}, {23, 37}. Another partition of that set is: {3}, {11, 23, 31, 37}. From the Mathworld entry for Bell number ( http://mathworld.wolfram.com/BellNumber.html ): "The number of ways a set of n elements can be partitioned into nonempty subsets is called a Bell number and is denoted Bn (not to be confused with the Bernoulli number, which is also commonly denoted Bn). The number of partitions of a 5-element set such as {3, 11, 23, 31, 37} is 52, so there are 50 partitions besides the two you give as examples, {3, 11, 31},{23, 37} and {3},{11, 23, 31, 37}. (... except that your term "pair" may mean you're considering only the partitions that have exactly two subsets of the original set. See below.) Does all this make sense? Am I correctly interpreting what you mean, SarK0Y? Quote:
Suppose partition 0 is {{3, 11, 31}, {23, 37}}. Then X(0) = 3*11*31 = 1023 and Y(0) = 23*37 = 851 and, using "M(n)" instead of "MIN(n)" to avoid confusion with the minimum function, |X(0)-Y(0)|==M(0), so M(0) = |1023-851| = 172. Okay so far? In your 3-element example {2, 5, 7}, partition 0 ("first pair") is {{2, 5}, {7}} and partition 1 ("second pair") is {{2, 7}, {5}}. Is the "third pair" (partition 2) = ({5, 7}, {2}} ? Do you have any use for the partition {{2}, {7}, {5}}, or does your term "pair" mean you're considering only the partitions that have exactly two subsets of the original set? How are you ordering the partitions? What determines which partition is "first pair" = partition 0? Last fiddled with by cheesehead on 2010-03-08 at 21:43 Reason: tidying up |
||
|
|
|
|
|
#5 |
|
Jun 2003
508710 Posts |
Code:
N=2*5*7; s=0;fordiv(N,x,if(x*x>=N,d=x-N/x;print(N/x, ",", x, " -> ", d, ":", d-s);s=d)) result: 7,10 -> 3:3 5,14 -> 9:6 2,35 -> 33:24 1,70 -> 69:36 |
|
|
|
|
|
#6 | |||
|
Jan 2010
1268 Posts |
Thanks for reply, Amici.
cheesehead Bell numbers is more common task. Quote:
Quote:
Quote:
Last fiddled with by SarK0Y on 2010-03-09 at 00:46 |
|||
|
|
|
|
|
#7 |
|
Jan 2010
2×43 Posts |
i got M(0) with following algo:
//(given: set I with n integers) sort(I); //I(0)<I(1)..<I(n-1) int x=n-1, y=n-2; for(int i=n-3; i>-1; i--) { if(x>y)y*=I(i); else x*=I(i); } ------- suggestions about other iterations shall be very appreciated:-) |
|
|
|
|
|
#8 |
|
Jan 2010
8610 Posts |
small correction: int x=M(n-1), y=M(n-2);
|
|
|
|