SHARE
TWEET

Untitled

a guest May 20th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (*48 variables*)
  2.  
  3. Clear[a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2, f2, g2, h2,
  4.   a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4, f4, g4, h4, a5,
  5.   b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6, f6, g6, h6];
  6.  
  7. a1 = 27;
  8. b1 = -18;
  9. c1 = 1;
  10. d1 = 4;
  11. e1 = 23;
  12. f1 = 26;
  13. g1 = 13;
  14. h1 = 32;
  15.  
  16. a2 = 19;
  17. b2 = 22;
  18. c2 = 41;
  19. d2 = 44;
  20. e2 = 31;
  21. f2 = 18;
  22. g2 = 37;
  23. h2 = 24;
  24.  
  25. a3 = 27;
  26. b3 = 46;
  27. c3 = 33;
  28. d3 = 36;
  29. e3 = 23;
  30. f3 = -6;
  31. g3 = -3;
  32. h3 = 16;
  33.  
  34. a4 = 19;
  35. b4 = 38;
  36. c4 = 41;
  37. d4 = 12;
  38. e4 = -1;
  39. f4 = 2;
  40. g4 = -11;
  41. h4 = 8;
  42.  
  43. a5 = 11;
  44. b5 = -2;
  45. c5 = 17;
  46. d5 = 4;
  47. e5 = -9;
  48. f5 = -6;
  49. g5 = 13;
  50. h5 = 16;
  51.  
  52. a6 = 3;
  53. b6 = 22;
  54. c6 = 9;
  55. d6 = 12;
  56. e6 = 31;
  57. f6 = 34;
  58. g6 = 53;
  59. h6 = 8;
  60.  
  61. (*
  62. sol={a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,\
  63. f3,g3,h3,a4,b4,c4,d4,e4,f4,g4,h4,a5,b5,c5,d5,e5,f5,g5,h5,a6,b6,c6,d6,\
  64. e6,f6,g6,h6}/.Solve[{
  65. *)
  66.  
  67.  
  68. Max[{a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2, f2, g2, h2,
  69.    a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4, f4, g4, h4, a5,
  70.     b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6, f6, g6, h6}] == 53
  71.  
  72. Min[{a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2, f2, g2, h2,
  73.    a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4, f4, g4, h4, a5,
  74.     b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6, f6, g6, h6}] == -18
  75.  
  76. h6 == 8(*last value hard coded constraint*)
  77. g6 == 53(*penultimate value hard coded constraint*)
  78. g6 > 0 (*penultimate value > 0*)
  79.  
  80. Total[{a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2, f2, g2, h2,
  81.      a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4, f4, g4, h4,
  82.     a5, b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6, f6, g6, h6} -
  83.    Sort[{a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2, f2, g2,
  84.      h2, a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4, f4, g4,
  85.      h4, a5, b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6, f6, g6,
  86.      h6}]] == 0
  87.  
  88. Abs[Total[{a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2, f2, g2,
  89.       h2, a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4, f4, g4,
  90.      h4, a5, b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6, f6, g6,
  91.      h6}] - Sort[{a1, b1, c1, d1, e1, f1, g1, h1, a2, b2, c2, d2, e2,
  92.      f2, g2, h2, a3, b3, c3, d3, e3, f3, g3, h3, a4, b4, c4, d4, e4,
  93.      f4, g4, h4, a5, b5, c5, d5, e5, f5, g5, h5, a6, b6, c6, d6, e6,
  94.      f6, g6, h6}]] == 16*12
  95.  
  96.  
  97. a1 + h6 == 35
  98. b1 + g6 == 35
  99. c1 + f6 == 35
  100. d1 + e6 == 35
  101. e1 + d6 == 35
  102. f1 + c6 == 35
  103. g1 + b6 == 35
  104. h1 + a6 == 35
  105.  
  106. a2 + h5 == 35
  107. b2 + g5 == 35
  108. c2 + f5 == 35
  109. d2 + e5 == 35
  110. e2 + d5 == 35
  111. f2 + c5 == 35
  112. g2 + b5 == 35
  113. h2 + a5 == 35
  114.  
  115. a3 + h4 == 35
  116. b3 + g4 == 35
  117. c3 + f4 == 35
  118. d3 + e4 == 35
  119. e3 + d4 == 35
  120. f3 + c4 == 35
  121. g3 + b4 == 35
  122. h3 + a4 == 35
  123.  
  124.  
  125. a1 + b1 + c1 + d1 + e1 + f1 + g1 + h1 + a2 + b2 + c2 + d2 + e2 + f2 +
  126.   g2 + h2 + a3 + b3 + c3 + d3 + e3 + f3 + g3 + h3 + a4 + b4 + c4 +
  127.   d4 + e4 + f4 + g4 + h4 + a5 + b5 + c5 + d5 + e5 + f5 + g5 + h5 +
  128.   a6 + b6 + c6 + d6 + e6 + f6 + g6 + h6 == 840
  129.  
  130. a1 - b1 == g6 - h6
  131. b1 - c1 == f6 - g6
  132. c1 - d1 == e6 - f6
  133. d1 - e1 == d6 - e6
  134. e1 - f1 == c6 - d6
  135. f1 - g1 == b6 - c6
  136. g1 - h1 == a6 - b6
  137. h1 - a2 == h5 - a6
  138.  
  139. a2 - b2 == g5 - h5
  140. b2 - c2 == f5 - g5
  141. c2 - d2 == e5 - f5
  142. d2 - e2 == d5 - e5
  143. e2 - f2 == c5 - d5
  144. f2 - g2 == b5 - c5
  145. g2 - h2 == a5 - b5
  146. h2 - a3 == h4 - a5
  147.  
  148. a3 - b3 == g4 - h4
  149. b3 - c3 == f4 - g4
  150. c3 - d3 == e4 - f4
  151. d3 - e3 == d4 - e4
  152. e3 - f3 == c4 - d4
  153. f3 - g3 == b4 - c4
  154. g3 - h3 == a4 - b4
  155. (*h3-a4\[Equal]h3-a4,*)
  156. h3 - a4 ==
  157.  f3 - g3 (*two additional middle value formulas, also valid for 8, \
  158. 480, 5760 and larger rows maybe*)
  159. h3 - a4 == b4 - c4
  160.  
  161. a1 - b1 + b1 - c1 + c1 - d1 + d1 - e1 + e1 - f1 + f1 - g1 + g1 - h1 +
  162.   h1 - a2 + a2 - b2 + b2 - c2 + c2 - d2 + d2 - e2 + e2 - f2 + f2 -
  163.   g2 + g2 - h2 + h2 - a3 + a3 - b3 + b3 - c3 + c3 - d3 + d3 - e3 +
  164.   e3 - f3 + f3 - g3 + g3 - h3 + g6 - h6 + f6 - g6 + e6 - f6 + d6 -
  165.   e6 + c6 - d6 + b6 - c6 + a6 - b6 + h5 - a6 + g5 - h5 + f5 - g5 +
  166.   e5 - f5 + d5 - e5 + c5 - d5 + b5 - c5 + a5 - b5 + h4 - a5 + g4 -
  167.   h4 + f4 - g4 + e4 - f4 + d4 - e4 + c4 - d4 + b4 - c4 + a4 -
  168.   b4 == 19 (*maybe missed some values, this is 22 but I think should \
  169. be 19*)
  170.  
  171. (*-19 is min value of nx1 - nx2, also works for 8, 48, 480 and 5760 \
  172. (ie +-617 for 5760) and maybe larger rows*)
  173.  
  174.  
  175. (*
  176. },
  177. {a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,\
  178. h3,a4,b4,c4,d4,e4,f4,g4,h4,a5,b5,c5,d5,e5,f5,g5,h5,a6,b6,c6,d6,e6,f6,\
  179. g6,h6},Integers]
  180. *)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top