Author Topic: Find the result n1 m1 n2 m2  (Read 3062 times)

0 Members and 1 Guest are viewing this topic.

well20152016

  • Newt
  • Posts: 130
Find the result n1 m1 n2 m2
« on: December 18, 2021, 04:07:13 AM »
Known: 28 = n1*8 + m1*3  + n2*5 + m2*4

result1  n1=3 m1=0  n2=0 m2=1
result2  n1=0 m1=8  n2=0 m2=1
result3  n1=1 m1=4  n2=0 m2=2
result4  ......

 




« Last Edit: December 18, 2021, 06:57:09 AM by well20152016 »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Find the result n1 m1 n2 m2
« Reply #1 on: December 18, 2021, 06:46:55 AM »
Result1 and Result2 are wrong I think.
I assume they should be:
Code: [Select]
result1  n1=3 m1=0  n2=0 m2=1
result2  n1=0 m1=8  n2=0 m2=1

well20152016

  • Newt
  • Posts: 130
Re: Find the result n1 m1 n2 m2
« Reply #2 on: December 18, 2021, 06:55:19 AM »
 28 = 1*8 + 4*3  + 0*5 + 2*4

28 = 0*8 + 6*3  + 2*5 + 0*4

Find all results

« Last Edit: December 18, 2021, 06:59:27 AM by well20152016 »

well20152016

  • Newt
  • Posts: 130
Re: Find the result n1 m1 n2 m2
« Reply #3 on: December 19, 2021, 03:17:10 AM »
It can be done with lisp

Stefan

  • Bull Frog
  • Posts: 319
  • The most I miss IRL is the Undo button
Re: Find the result n1 m1 n2 m2
« Reply #4 on: December 19, 2021, 05:22:44 AM »
Code - Auto/Visual Lisp: [Select]
  1. (defun decomp (n l / fact sol res)
  2.  
  3.   (defun fact (a b / i l)
  4.     (repeat (setq i (1+ (/ a b)))
  5.       (setq i (1- i)
  6.             l (cons i l)
  7.       )
  8.     )
  9.     l
  10.   )
  11.  
  12.   (defun sol (n l r)
  13.     (cond
  14.       ((zerop n)
  15.        (setq res (cons r res))
  16.       )
  17.       (l
  18.         (foreach x (fact n (car l))
  19.           (sol (- n (* x (car l))) (cdr l) (cons x r))
  20.         )
  21.       )
  22.     )
  23.   )
  24.  
  25.   (sol n l nil)
  26.  
  27.   (mapcar
  28.    '(lambda (x)
  29.       (repeat (- (length l) (length x))
  30.         (setq x (cons 0 x))
  31.       )
  32.       (reverse x)
  33.     )
  34.     res
  35.   )
  36. )

Tested with positive numbers only.

Code: [Select]
(defun test (n l)
  (foreach x (decomp n l)
    (print l)
    (princ "x ")
    (princ x)
    (princ " = ")
    (princ (apply '+ (mapcar '* x l)))
  )
  (princ)
)

_$ (test 28 '(8 3 5 4))

(8 3 5 4) x (3 0 0 1) = 28
(8 3 5 4) x (2 4 0 0) = 28
(8 3 5 4) x (2 1 1 1) = 28
(8 3 5 4) x (2 0 0 3) = 28
(8 3 5 4) x (1 5 1 0) = 28
(8 3 5 4) x (1 4 0 2) = 28
(8 3 5 4) x (1 2 2 1) = 28
(8 3 5 4) x (1 1 1 3) = 28
(8 3 5 4) x (1 0 4 0) = 28
(8 3 5 4) x (1 0 0 5) = 28
(8 3 5 4) x (0 8 0 1) = 28
(8 3 5 4) x (0 6 2 0) = 28
(8 3 5 4) x (0 5 1 2) = 28
(8 3 5 4) x (0 4 0 4) = 28
(8 3 5 4) x (0 3 3 1) = 28
(8 3 5 4) x (0 2 2 3) = 28
(8 3 5 4) x (0 1 5 0) = 28
(8 3 5 4) x (0 1 1 5) = 28
(8 3 5 4) x (0 0 4 2) = 28
(8 3 5 4) x (0 0 0 7) = 28


well20152016

  • Newt
  • Posts: 130
Re: Find the result n1 m1 n2 m2
« Reply #5 on: December 19, 2021, 05:55:47 AM »
Thank you. It can only be positive. Should there be a better algorithm?
« Last Edit: December 20, 2021, 06:10:20 PM by well20152016 »

well20152016

  • Newt
  • Posts: 130
Re: Find the result n1 m1 n2 m2
« Reply #6 on: December 19, 2021, 08:33:53 PM »


Is there a faster and simpler way?
« Last Edit: December 30, 2021, 05:50:09 PM by well20152016 »

mhupp

  • Bull Frog
  • Posts: 250
Re: Find the result n1 m1 n2 m2
« Reply #7 on: December 20, 2021, 07:45:53 AM »
Found this awhile back converting equations into lisp.

Code: [Select]
(str2prefix "n1*8 + m1*3  + n2*5 + m2*4") ==> (+ (+ (+ (* N1 8) (* M1 3)) (* N2 5)) (* M2 4))
or if you have all the variables defined.
(calculate "n1*8 + m1*3  + n2*5 + m2*4") = 28

Code - Auto/Visual Lisp: [Select]
  1. ;Original code from: http://www.lispology.com/show?JIH  by: johnsondavies
  2.  
  3. ;Infix notation Converter and Calculator
  4. ; Supports: + - * / ^ ( )
  5. ; _Examples_
  6. ;
  7. ;(str2prefix "B*8-5/2^(2 PI)")                                  ->      (- (* B 8) (/ 5 (EXPT 2 (* 2 PI))))
  8. ;(setq B 4.6)
  9. ;(calculate "B*8-5/2^(2 PI)")                                   ->      36.7358
  10. ;(eval (infix-prefix '(10 - 3 - 2 - 1)))        ->  4
  11. ;(infix-prefix '(10 - 3 - 2 - 1))                       ->      (- (- (- 10 3) 2) 1)
  12. ;It also handles unary - and +, and implicit multiplication:
  13. ; (infix-prefix '(- 2 a + b))                                   ->      (+ (* (- 2) A) B)
  14.  
  15.  
  16.  
  17. (defun str2prefix (str / i cache)
  18.   (setq i 1 cache "(")
  19.   (repeat (strlen str)
  20.     (setq char (substr str i 1))
  21.     (if (member char '( "+" "-" "*" "/" "(" ")" "^" "%"))
  22.       (setq cache (strcat cache " " char " "))
  23.       (setq cache (strcat cache char))
  24.     )
  25.     (setq i (1+ i))
  26.   )
  27.   (setq cache (strcat cache ")"))
  28.   (infix-prefix (read cache))
  29. )
  30.  
  31. (defun calculate (str) (eval (str2prefix str)))
  32. (setq *binary-operators* '((+ 1 +) (- 1 -) (* 2 *) (/ 2 /) (^ 3 expt)))  ;removed (x 2 *) to avoid accidents
  33. (setq *unary-operators* '((+ 4 +) (- 4 -)))
  34. (defun weight (c) (cadr (assoc c *binary-operators*)))
  35. (defun binary-opcode (c) (caddr (assoc c *binary-operators*)))
  36. (defun unary-opcode (c) (caddr (assoc c *unary-operators*)))
  37.  
  38. (defun infix-prefix (ae)
  39.   (cond
  40.     ((atom ae) ae)
  41.     (t (inf-aux ae nil nil))
  42.   )
  43. )
  44.  
  45. (defun inf-aux (ae operators operands)
  46.   (cond
  47.   ;; Unary operator
  48.     ((and (atom (car ae)) (assoc (car ae) *unary-operators*))
  49.           (inf-iter (cddr ae) operators (cons
  50.                                           (list
  51.                                             (unary-opcode (car ae))
  52.                                             (infix-prefix (cadr ae))
  53.                                           )
  54.                       operands
  55.                     )
  56.           )
  57.     )
  58.     (t (inf-iter (cdr ae) operators (cons (infix-prefix (car ae)) operands)))
  59.   )
  60. )
  61.  
  62. (defun inf-iter (ae operators operands)
  63.   (cond
  64.     ((and (null ae) (null operators)) (car operands))
  65.     ;; Implicit multiplication
  66.     ((and ae
  67.           (or (listp (car ae))
  68.               (null (weight (car ae)))
  69.           )
  70.      )
  71.       (inf-iter (cons '* ae) operators operands)
  72.     )
  73.     ((and ae
  74.           (or (null operators)
  75.               (> (weight (car ae)) (weight (car operators)))
  76.           )
  77.      )
  78.       (inf-aux (cdr ae) (cons (car ae) operators) operands)
  79.     )
  80.     (t
  81.       (inf-iter ae (cdr operators)
  82.                 (cons (list (binary-opcode (car operators))
  83.                             (cadr operands) (car operands)
  84.                       )
  85.                   (cddr operands)
  86.                 )
  87.       )
  88.     )
  89.   )
  90. )


« Last Edit: December 20, 2021, 08:09:10 AM by mhupp »

well20152016

  • Newt
  • Posts: 130
Re: Find the result n1 m1 n2 m2
« Reply #8 on: December 20, 2021, 06:08:46 PM »
I want to see if there is a faster algorithm?

Stefan Fastest! :smitten:

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Find the result n1 m1 n2 m2
« Reply #9 on: December 21, 2021, 07:29:07 AM »
Another, using a similar method to Stefan:
Code - Auto/Visual Lisp: [Select]
  1. (defun solve ( ans coe / rec rtn )
  2.  
  3.     (defun rec ( ans mt1 co1 mtl col acc )
  4.         (cond
  5.             (   (zerop ans)
  6.                 (repeat (- (length coe) (length acc)) (setq acc (cons 0 acc)))
  7.                 (setq rtn (cons (reverse acc) rtn))
  8.             )
  9.             (   (and (< 0 ans) (<= 0 mt1))
  10.                 (rec ans (1- mt1) co1 mtl col acc)
  11.                 (rec (- ans (* mt1 co1)) (car mtl) (car col) (cdr mtl) (cdr col) (cons mt1 acc))
  12.             )
  13.         )
  14.     )
  15.  
  16.     (   (lambda ( mtl ) (rec ans (car mtl) (car coe) (cdr mtl) (cdr coe) nil))
  17.         (mapcar '(lambda ( x ) (/ ans x)) coe)
  18.     )
  19.     rtn
  20. )
Code - Auto/Visual Lisp: [Select]
  1. _$ (test 28 '(8 3 5 4))
  2.  
  3. (8 3 5 4) x (3 0 0 1) = 28
  4. (8 3 5 4) x (2 4 0 0) = 28
  5. (8 3 5 4) x (2 1 1 1) = 28
  6. (8 3 5 4) x (2 0 0 3) = 28
  7. (8 3 5 4) x (1 5 1 0) = 28
  8. (8 3 5 4) x (1 4 0 2) = 28
  9. (8 3 5 4) x (1 2 2 1) = 28
  10. (8 3 5 4) x (1 1 1 3) = 28
  11. (8 3 5 4) x (1 0 4 0) = 28
  12. (8 3 5 4) x (1 0 0 5) = 28
  13. (8 3 5 4) x (0 8 0 1) = 28
  14. (8 3 5 4) x (0 6 2 0) = 28
  15. (8 3 5 4) x (0 5 1 2) = 28
  16. (8 3 5 4) x (0 4 0 4) = 28
  17. (8 3 5 4) x (0 3 3 1) = 28
  18. (8 3 5 4) x (0 2 2 3) = 28
  19. (8 3 5 4) x (0 1 5 0) = 28
  20. (8 3 5 4) x (0 1 1 5) = 28
  21. (8 3 5 4) x (0 0 4 2) = 28
  22. (8 3 5 4) x (0 0 0 7) = 28

(Positive integer solutions only)

Stefan

  • Bull Frog
  • Posts: 319
  • The most I miss IRL is the Undo button
Re: Find the result n1 m1 n2 m2
« Reply #10 on: December 21, 2021, 08:41:48 AM »
Here is a faster version (faster than my previous one)

Code - Auto/Visual Lisp: [Select]
  1. (defun decomp (n l / fact sol res)
  2.  
  3.   (defun fact (n / l)
  4.     (repeat (1+ n)
  5.       (setq l (cons n l)
  6.             n (1- n)
  7.       )
  8.     )
  9.     l
  10.   )
  11.  
  12.   (defun sol (n l r)
  13.     (cond
  14.       (l
  15.         (foreach x (if
  16.                      (cadr l)
  17.                      (fact (fix (/ n (car l))))
  18.                      (if
  19.                        (zerop (rem n (car l)))
  20.                        (list (fix (/ n (car l))))
  21.                      )
  22.                    )
  23.           (sol (- n (* x (car l))) (cdr l) (cons x r))
  24.         )
  25.       )
  26.       ((zerop n)
  27.        (setq res (cons (reverse r) res))
  28.        nil
  29.       )
  30.     )
  31.   )
  32.  
  33.   (sol n l nil)
  34.  
  35.   res
  36. )

@ LeeMac, this looks similar to your "give change" challenge. I wonder if we can use here some of the ideas.


well20152016

  • Newt
  • Posts: 130
Re: Find the result n1 m1 n2 m2
« Reply #11 on: December 21, 2021, 09:28:24 AM »
Thank you very much for your participation! An interesting challenge!

Stefan  decomp
Code - HTML5: [Select]
  1. (test 28 '(8 3 5.5 4.5 2.5 1.5))
  2. (8 3 5.5 4.5 2.5 1.5) x (3 0 0 0 1 1) = 28.0 -1
  3. (8 3 5.5 4.5 2.5 1.5) x (2 4 0 0 0 0) = 28.0 -2
  4. (8 3 5.5 4.5 2.5 1.5) x (2 3 0 0 0 2) = 28.0 -3
  5. (8 3 5.5 4.5 2.5 1.5) x (2 2 0 1 0 1) = 28.0 -4
  6. (8 3 5.5 4.5 2.5 1.5) x (2 2 0 0 0 4) = 28.0 -5
  7. (8 3 5.5 4.5 2.5 1.5) x (2 1 0 2 0 0) = 28.0 -6
  8. (8 3 5.5 4.5 2.5 1.5) x (2 1 0 1 0 3) = 28.0 -7
  9. (8 3 5.5 4.5 2.5 1.5) x (2 1 0 0 3 1) = 28.0 -8
  10. (8 3 5.5 4.5 2.5 1.5) x (2 1 0 0 0 6) = 28.0 -9
  11. (8 3 5.5 4.5 2.5 1.5) x (2 0 1 0 2 1) = 28.0 -10
  12. (8 3 5.5 4.5 2.5 1.5) x (2 0 0 2 0 2) = 28.0 -11
  13. (8 3 5.5 4.5 2.5 1.5) x (2 0 0 1 3 0) = 28.0 -12
  14. (8 3 5.5 4.5 2.5 1.5) x (2 0 0 1 0 5) = 28.0 -13
  15. (8 3 5.5 4.5 2.5 1.5) x (2 0 0 0 3 3) = 28.0 -14
  16. (8 3 5.5 4.5 2.5 1.5) x (2 0 0 0 0 8) = 28.0 -15
  17. (8 3 5.5 4.5 2.5 1.5) x (1 5 0 0 2 0) = 28.0 -16
  18. (8 3 5.5 4.5 2.5 1.5) x (1 4 1 0 1 0) = 28.0 -17
  19. (8 3 5.5 4.5 2.5 1.5) x (1 4 0 0 2 2) = 28.0 -18
  20. (8 3 5.5 4.5 2.5 1.5) x (1 3 2 0 0 0) = 28.0 -19
  21. (8 3 5.5 4.5 2.5 1.5) x (1 3 1 0 1 2) = 28.0 -20
  22. (8 3 5.5 4.5 2.5 1.5) x (1 3 0 1 2 1) = 28.0 -21
  23. (8 3 5.5 4.5 2.5 1.5) x (1 3 0 0 2 4) = 28.0 -22
  24. (8 3 5.5 4.5 2.5 1.5) x (1 2 2 0 0 2) = 28.0 -23
  25. (8 3 5.5 4.5 2.5 1.5) x (1 2 1 1 1 1) = 28.0 -24
  26. (8 3 5.5 4.5 2.5 1.5) x (1 2 1 0 1 4) = 28.0 -25
  27. (8 3 5.5 4.5 2.5 1.5) x (1 2 0 2 2 0) = 28.0 -26
  28. (8 3 5.5 4.5 2.5 1.5) x (1 2 0 1 2 3) = 28.0 -27
  29. (8 3 5.5 4.5 2.5 1.5) x (1 2 0 0 5 1) = 28.0 -28
  30. (8 3 5.5 4.5 2.5 1.5) x (1 2 0 0 2 6) = 28.0 -29
  31. (8 3 5.5 4.5 2.5 1.5) x (1 1 2 1 0 1) = 28.0 -30
  32. (8 3 5.5 4.5 2.5 1.5) x (1 1 2 0 0 4) = 28.0 -31
  33. (8 3 5.5 4.5 2.5 1.5) x (1 1 1 2 1 0) = 28.0 -32
  34. (8 3 5.5 4.5 2.5 1.5) x (1 1 1 1 1 3) = 28.0 -33
  35. (8 3 5.5 4.5 2.5 1.5) x (1 1 1 0 4 1) = 28.0 -34
  36. (8 3 5.5 4.5 2.5 1.5) x (1 1 1 0 1 6) = 28.0 -35
  37. (8 3 5.5 4.5 2.5 1.5) x (1 1 0 2 2 2) = 28.0 -36
  38. (8 3 5.5 4.5 2.5 1.5) x (1 1 0 1 5 0) = 28.0 -37
  39. (8 3 5.5 4.5 2.5 1.5) x (1 1 0 1 2 5) = 28.0 -38
  40. (8 3 5.5 4.5 2.5 1.5) x (1 1 0 0 5 3) = 28.0 -39
  41. (8 3 5.5 4.5 2.5 1.5) x (1 1 0 0 2 8) = 28.0 -40
  42. (8 3 5.5 4.5 2.5 1.5) x (1 0 2 2 0 0) = 28.0 -41
  43. (8 3 5.5 4.5 2.5 1.5) x (1 0 2 1 0 3) = 28.0 -42
  44. (8 3 5.5 4.5 2.5 1.5) x (1 0 2 0 3 1) = 28.0 -43
  45. (8 3 5.5 4.5 2.5 1.5) x (1 0 2 0 0 6) = 28.0 -44
  46. (8 3 5.5 4.5 2.5 1.5) x (1 0 1 2 1 2) = 28.0 -45
  47. (8 3 5.5 4.5 2.5 1.5) x (1 0 1 1 4 0) = 28.0 -46
  48. (8 3 5.5 4.5 2.5 1.5) x (1 0 1 1 1 5) = 28.0 -47
  49. (8 3 5.5 4.5 2.5 1.5) x (1 0 1 0 4 3) = 28.0 -48
  50. (8 3 5.5 4.5 2.5 1.5) x (1 0 1 0 1 8) = 28.0 -49
  51. (8 3 5.5 4.5 2.5 1.5) x (1 0 0 3 2 1) = 28.0 -50
  52. (8 3 5.5 4.5 2.5 1.5) x (1 0 0 2 2 4) = 28.0 -51
  53. (8 3 5.5 4.5 2.5 1.5) x (1 0 0 1 5 2) = 28.0 -52
  54. (8 3 5.5 4.5 2.5 1.5) x (1 0 0 1 2 7) = 28.0 -53
  55. (8 3 5.5 4.5 2.5 1.5) x (1 0 0 0 8 0) = 28.0 -54
  56. (8 3 5.5 4.5 2.5 1.5) x (1 0 0 0 5 5) = 28.0 -55
  57. (8 3 5.5 4.5 2.5 1.5) x (1 0 0 0 2 10) = 28.0 -56
  58. (8 3 5.5 4.5 2.5 1.5) x (0 8 0 0 1 1) = 28.0 -57
  59. (8 3 5.5 4.5 2.5 1.5) x (0 7 1 0 0 1) = 28.0 -58
  60. (8 3 5.5 4.5 2.5 1.5) x (0 7 0 1 1 0) = 28.0 -59
  61. (8 3 5.5 4.5 2.5 1.5) x (0 7 0 0 1 3) = 28.0 -60
  62. (8 3 5.5 4.5 2.5 1.5) x (0 6 1 1 0 0) = 28.0 -61
  63. (8 3 5.5 4.5 2.5 1.5) x (0 6 1 0 0 3) = 28.0 -62
  64. (8 3 5.5 4.5 2.5 1.5) x (0 6 0 1 1 2) = 28.0 -63
  65. (8 3 5.5 4.5 2.5 1.5) x (0 6 0 0 4 0) = 28.0 -64
  66. (8 3 5.5 4.5 2.5 1.5) x (0 6 0 0 1 5) = 28.0 -65
  67. (8 3 5.5 4.5 2.5 1.5) x (0 5 1 1 0 2) = 28.0 -66
  68. (8 3 5.5 4.5 2.5 1.5) x (0 5 1 0 3 0) = 28.0 -67
  69. (8 3 5.5 4.5 2.5 1.5) x (0 5 1 0 0 5) = 28.0 -68
  70. (8 3 5.5 4.5 2.5 1.5) x (0 5 0 2 1 1) = 28.0 -69
  71. (8 3 5.5 4.5 2.5 1.5) x (0 5 0 1 1 4) = 28.0 -70
  72. (8 3 5.5 4.5 2.5 1.5) x (0 5 0 0 4 2) = 28.0 -71
  73. (8 3 5.5 4.5 2.5 1.5) x (0 5 0 0 1 7) = 28.0 -72
  74. (8 3 5.5 4.5 2.5 1.5) x (0 4 2 0 2 0) = 28.0 -73
  75. (8 3 5.5 4.5 2.5 1.5) x (0 4 1 2 0 1) = 28.0 -74
  76. (8 3 5.5 4.5 2.5 1.5) x (0 4 1 1 0 4) = 28.0 -75
  77. (8 3 5.5 4.5 2.5 1.5) x (0 4 1 0 3 2) = 28.0 -76
  78. (8 3 5.5 4.5 2.5 1.5) x (0 4 1 0 0 7) = 28.0 -77
  79. (8 3 5.5 4.5 2.5 1.5) x (0 4 0 3 1 0) = 28.0 -78
  80. (8 3 5.5 4.5 2.5 1.5) x (0 4 0 2 1 3) = 28.0 -79
  81. (8 3 5.5 4.5 2.5 1.5) x (0 4 0 1 4 1) = 28.0 -80
  82. (8 3 5.5 4.5 2.5 1.5) x (0 4 0 1 1 6) = 28.0 -81
  83. (8 3 5.5 4.5 2.5 1.5) x (0 4 0 0 4 4) = 28.0 -82
  84. (8 3 5.5 4.5 2.5 1.5) x (0 4 0 0 1 9) = 28.0 -83
  85. (8 3 5.5 4.5 2.5 1.5) x (0 3 3 0 1 0) = 28.0 -84
  86. (8 3 5.5 4.5 2.5 1.5) x (0 3 2 0 2 2) = 28.0 -85
  87. (8 3 5.5 4.5 2.5 1.5) x (0 3 1 3 0 0) = 28.0 -86
  88. (8 3 5.5 4.5 2.5 1.5) x (0 3 1 2 0 3) = 28.0 -87
  89. (8 3 5.5 4.5 2.5 1.5) x (0 3 1 1 3 1) = 28.0 -88
  90. (8 3 5.5 4.5 2.5 1.5) x (0 3 1 1 0 6) = 28.0 -89
  91. (8 3 5.5 4.5 2.5 1.5) x (0 3 1 0 3 4) = 28.0 -90
  92. (8 3 5.5 4.5 2.5 1.5) x (0 3 1 0 0 9) = 28.0 -91
  93. (8 3 5.5 4.5 2.5 1.5) x (0 3 0 3 1 2) = 28.0 -92
  94. (8 3 5.5 4.5 2.5 1.5) x (0 3 0 2 4 0) = 28.0 -93
  95. (8 3 5.5 4.5 2.5 1.5) x (0 3 0 2 1 5) = 28.0 -94
  96. (8 3 5.5 4.5 2.5 1.5) x (0 3 0 1 4 3) = 28.0 -95
  97. (8 3 5.5 4.5 2.5 1.5) x (0 3 0 1 1 8) = 28.0 -96
  98. (8 3 5.5 4.5 2.5 1.5) x (0 3 0 0 7 1) = 28.0 -97
  99. (8 3 5.5 4.5 2.5 1.5) x (0 3 0 0 4 6) = 28.0 -98
  100. (8 3 5.5 4.5 2.5 1.5) x (0 3 0 0 1 11) = 28.0 -99
  101. (8 3 5.5 4.5 2.5 1.5) x (0 2 4 0 0 0) = 28.0 -100
  102. (8 3 5.5 4.5 2.5 1.5) x (0 2 3 0 1 2) = 28.0 -101
  103. (8 3 5.5 4.5 2.5 1.5) x (0 2 2 1 2 1) = 28.0 -102
  104. (8 3 5.5 4.5 2.5 1.5) x (0 2 2 0 2 4) = 28.0 -103
  105. (8 3 5.5 4.5 2.5 1.5) x (0 2 1 3 0 2) = 28.0 -104
  106. (8 3 5.5 4.5 2.5 1.5) x (0 2 1 2 3 0) = 28.0 -105
  107. (8 3 5.5 4.5 2.5 1.5) x (0 2 1 2 0 5) = 28.0 -106
  108. (8 3 5.5 4.5 2.5 1.5) x (0 2 1 1 3 3) = 28.0 -107
  109. (8 3 5.5 4.5 2.5 1.5) x (0 2 1 1 0 8) = 28.0 -108
  110. (8 3 5.5 4.5 2.5 1.5) x (0 2 1 0 6 1) = 28.0 -109
  111. (8 3 5.5 4.5 2.5 1.5) x (0 2 1 0 3 6) = 28.0 -110
  112. (8 3 5.5 4.5 2.5 1.5) x (0 2 1 0 0 11) = 28.0 -111
  113. (8 3 5.5 4.5 2.5 1.5) x (0 2 0 4 1 1) = 28.0 -112
  114. (8 3 5.5 4.5 2.5 1.5) x (0 2 0 3 1 4) = 28.0 -113
  115. (8 3 5.5 4.5 2.5 1.5) x (0 2 0 2 4 2) = 28.0 -114
  116. (8 3 5.5 4.5 2.5 1.5) x (0 2 0 2 1 7) = 28.0 -115
  117. (8 3 5.5 4.5 2.5 1.5) x (0 2 0 1 7 0) = 28.0 -116
  118. (8 3 5.5 4.5 2.5 1.5) x (0 2 0 1 4 5) = 28.0 -117
  119. (8 3 5.5 4.5 2.5 1.5) x (0 2 0 1 1 10) = 28.0 -118
  120. (8 3 5.5 4.5 2.5 1.5) x (0 2 0 0 7 3) = 28.0 -119
  121. (8 3 5.5 4.5 2.5 1.5) x (0 2 0 0 4 8) = 28.0 -120
  122. (8 3 5.5 4.5 2.5 1.5) x (0 2 0 0 1 13) = 28.0 -121
  123. (8 3 5.5 4.5 2.5 1.5) x (0 1 4 0 0 2) = 28.0 -122
  124. (8 3 5.5 4.5 2.5 1.5) x (0 1 3 1 1 1) = 28.0 -123
  125. (8 3 5.5 4.5 2.5 1.5) x (0 1 3 0 1 4) = 28.0 -124
  126. (8 3 5.5 4.5 2.5 1.5) x (0 1 2 2 2 0) = 28.0 -125
  127. (8 3 5.5 4.5 2.5 1.5) x (0 1 2 1 2 3) = 28.0 -126
  128. (8 3 5.5 4.5 2.5 1.5) x (0 1 2 0 5 1) = 28.0 -127
  129. (8 3 5.5 4.5 2.5 1.5) x (0 1 2 0 2 6) = 28.0 -128
  130. (8 3 5.5 4.5 2.5 1.5) x (0 1 1 4 0 1) = 28.0 -129
  131. (8 3 5.5 4.5 2.5 1.5) x (0 1 1 3 0 4) = 28.0 -130
  132. (8 3 5.5 4.5 2.5 1.5) x (0 1 1 2 3 2) = 28.0 -131
  133. (8 3 5.5 4.5 2.5 1.5) x (0 1 1 2 0 7) = 28.0 -132
  134. (8 3 5.5 4.5 2.5 1.5) x (0 1 1 1 6 0) = 28.0 -133
  135. (8 3 5.5 4.5 2.5 1.5) x (0 1 1 1 3 5) = 28.0 -134
  136. (8 3 5.5 4.5 2.5 1.5) x (0 1 1 1 0 10) = 28.0 -135
  137. (8 3 5.5 4.5 2.5 1.5) x (0 1 1 0 6 3) = 28.0 -136
  138. (8 3 5.5 4.5 2.5 1.5) x (0 1 1 0 3 8) = 28.0 -137
  139. (8 3 5.5 4.5 2.5 1.5) x (0 1 1 0 0 13) = 28.0 -138
  140. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 5 1 0) = 28.0 -139
  141. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 4 1 3) = 28.0 -140
  142. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 3 4 1) = 28.0 -141
  143. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 3 1 6) = 28.0 -142
  144. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 2 4 4) = 28.0 -143
  145. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 2 1 9) = 28.0 -144
  146. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 1 7 2) = 28.0 -145
  147. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 1 4 7) = 28.0 -146
  148. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 1 1 12) = 28.0 -147
  149. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 0 10 0) = 28.0 -148
  150. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 0 7 5) = 28.0 -149
  151. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 0 4 10) = 28.0 -150
  152. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 0 1 15) = 28.0 -151
  153. (8 3 5.5 4.5 2.5 1.5) x (0 0 4 1 0 1) = 28.0 -152
  154. (8 3 5.5 4.5 2.5 1.5) x (0 0 4 0 0 4) = 28.0 -153
  155. (8 3 5.5 4.5 2.5 1.5) x (0 0 3 2 1 0) = 28.0 -154
  156. (8 3 5.5 4.5 2.5 1.5) x (0 0 3 1 1 3) = 28.0 -155
  157. (8 3 5.5 4.5 2.5 1.5) x (0 0 3 0 4 1) = 28.0 -156
  158. (8 3 5.5 4.5 2.5 1.5) x (0 0 3 0 1 6) = 28.0 -157
  159. (8 3 5.5 4.5 2.5 1.5) x (0 0 2 2 2 2) = 28.0 -158
  160. (8 3 5.5 4.5 2.5 1.5) x (0 0 2 1 5 0) = 28.0 -159
  161. (8 3 5.5 4.5 2.5 1.5) x (0 0 2 1 2 5) = 28.0 -160
  162. (8 3 5.5 4.5 2.5 1.5) x (0 0 2 0 5 3) = 28.0 -161
  163. (8 3 5.5 4.5 2.5 1.5) x (0 0 2 0 2 8) = 28.0 -162
  164. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 5 0 0) = 28.0 -163
  165. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 4 0 3) = 28.0 -164
  166. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 3 3 1) = 28.0 -165
  167. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 3 0 6) = 28.0 -166
  168. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 2 3 4) = 28.0 -167
  169. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 2 0 9) = 28.0 -168
  170. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 1 6 2) = 28.0 -169
  171. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 1 3 7) = 28.0 -170
  172. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 1 0 12) = 28.0 -171
  173. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 0 9 0) = 28.0 -172
  174. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 0 6 5) = 28.0 -173
  175. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 0 3 10) = 28.0 -174
  176. (8 3 5.5 4.5 2.5 1.5) x (0 0 1 0 0 15) = 28.0 -175
  177. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 5 1 2) = 28.0 -176
  178. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 4 4 0) = 28.0 -177
  179. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 4 1 5) = 28.0 -178
  180. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 3 4 3) = 28.0 -179
  181. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 3 1 8) = 28.0 -180
  182. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 2 7 1) = 28.0 -181
  183. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 2 4 6) = 28.0 -182
  184. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 2 1 11) = 28.0 -183
  185. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 1 7 4) = 28.0 -184
  186. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 1 4 9) = 28.0 -185
  187. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 1 1 14) = 28.0 -186
  188. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 0 10 2) = 28.0 -187
  189. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 0 7 7) = 28.0 -188
  190. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 0 4 12) = 28.0 -189
  191. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 0 1 17) = 28.0 -190
  192. Completion time :0.21seconds
  193.  
  194.  

Lee Mac
Code - HTML5: [Select]
  1. (test 28 '(8 3 5.5 4.5 2.5 1.5))
  2. (8 3 5.5 4.5 2.5 1.5) x (2 4 0 0 0 0) = 28.0 -1
  3. (8 3 5.5 4.5 2.5 1.5) x (2 3 0.0909091 0.222222 0.2 0.666667) = 28.0 -2
  4. (8 3 5.5 4.5 2.5 1.5) x (2 2 1.09091 0 0 0) = 28.0 -3
  5. (8 3 5.5 4.5 2.5 1.5) x (2 2 0.0909091 1.22222 0 0) = 28.0 -4
  6. (8 3 5.5 4.5 2.5 1.5) x (2 2 0.0909091 0.222222 0.2 2.66667) = 28.0 -5
  7. (8 3 5.5 4.5 2.5 1.5) x (2 1 0.0909091 1.22222 0.2 1.66667) = 28.0 -6
  8. (8 3 5.5 4.5 2.5 1.5) x (2 1 0.0909091 0.222222 0.2 4.66667) = 28.0 -7
  9. (8 3 5.5 4.5 2.5 1.5) x (2 0 0.0909091 2.22222 0.2 0.666667) = 28.0 -8
  10. (8 3 5.5 4.5 2.5 1.5) x (2 0 0.0909091 1.22222 0.2 3.66667) = 28.0 -9
  11. (8 3 5.5 4.5 2.5 1.5) x (2 0 0.0909091 0.222222 3.2 1.66667) = 28.0 -10
  12. (8 3 5.5 4.5 2.5 1.5) x (2 0 0.0909091 0.222222 0.2 6.66667) = 28.0 -11
  13. (8 3 5.5 4.5 2.5 1.5) x (1 4 0.0909091 0.222222 2.2 0.666667) = 28.0 -12
  14. (8 3 5.5 4.5 2.5 1.5) x (1 3 0.0909091 0.222222 2.2 2.66667) = 28.0 -13
  15. (8 3 5.5 4.5 2.5 1.5) x (1 2 1.09091 0.222222 1.2 2.66667) = 28.0 -14
  16. (8 3 5.5 4.5 2.5 1.5) x (1 2 0.0909091 1.22222 2.2 1.66667) = 28.0 -15
  17. (8 3 5.5 4.5 2.5 1.5) x (1 2 0.0909091 0.222222 2.2 4.66667) = 28.0 -16
  18. (8 3 5.5 4.5 2.5 1.5) x (1 1 3.09091 0 0 0) = 28.0 -17
  19. (8 3 5.5 4.5 2.5 1.5) x (1 1 2.09091 1.22222 0 0) = 28.0 -18
  20. (8 3 5.5 4.5 2.5 1.5) x (1 1 2.09091 0.222222 0.2 2.66667) = 28.0 -19
  21. (8 3 5.5 4.5 2.5 1.5) x (1 1 1.09091 1.22222 1.2 1.66667) = 28.0 -20
  22. (8 3 5.5 4.5 2.5 1.5) x (1 1 1.09091 0.222222 1.2 4.66667) = 28.0 -21
  23. (8 3 5.5 4.5 2.5 1.5) x (1 1 0.0909091 2.22222 2.2 0.666667) = 28.0 -22
  24. (8 3 5.5 4.5 2.5 1.5) x (1 1 0.0909091 1.22222 2.2 3.66667) = 28.0 -23
  25. (8 3 5.5 4.5 2.5 1.5) x (1 1 0.0909091 0.222222 5.2 1.66667) = 28.0 -24
  26. (8 3 5.5 4.5 2.5 1.5) x (1 1 0.0909091 0.222222 2.2 6.66667) = 28.0 -25
  27. (8 3 5.5 4.5 2.5 1.5) x (1 0 2.09091 1.22222 0.2 1.66667) = 28.0 -26
  28. (8 3 5.5 4.5 2.5 1.5) x (1 0 2.09091 0.222222 0.2 4.66667) = 28.0 -27
  29. (8 3 5.5 4.5 2.5 1.5) x (1 0 1.09091 2.22222 1.2 0.666667) = 28.0 -28
  30. (8 3 5.5 4.5 2.5 1.5) x (1 0 1.09091 1.22222 1.2 3.66667) = 28.0 -29
  31. (8 3 5.5 4.5 2.5 1.5) x (1 0 1.09091 0.222222 4.2 1.66667) = 28.0 -30
  32. (8 3 5.5 4.5 2.5 1.5) x (1 0 1.09091 0.222222 1.2 6.66667) = 28.0 -31
  33. (8 3 5.5 4.5 2.5 1.5) x (1 0 0.0909091 2.22222 2.2 2.66667) = 28.0 -32
  34. (8 3 5.5 4.5 2.5 1.5) x (1 0 0.0909091 1.22222 5.2 0.666667) = 28.0 -33
  35. (8 3 5.5 4.5 2.5 1.5) x (1 0 0.0909091 1.22222 2.2 5.66667) = 28.0 -34
  36. (8 3 5.5 4.5 2.5 1.5) x (1 0 0.0909091 0.222222 5.2 3.66667) = 28.0 -35
  37. (8 3 5.5 4.5 2.5 1.5) x (1 0 0.0909091 0.222222 2.2 8.66667) = 28.0 -36
  38. (8 3 5.5 4.5 2.5 1.5) x (0 7 0.0909091 0.222222 1.2 1.66667) = 28.0 -37
  39. (8 3 5.5 4.5 2.5 1.5) x (0 6 0.0909091 1.22222 1.2 0.666667) = 28.0 -38
  40. (8 3 5.5 4.5 2.5 1.5) x (0 6 0.0909091 0.222222 1.2 3.66667) = 28.0 -39
  41. (8 3 5.5 4.5 2.5 1.5) x (0 5 1.09091 1.22222 0.2 0.666667) = 28.0 -40
  42. (8 3 5.5 4.5 2.5 1.5) x (0 5 1.09091 0.222222 0.2 3.66667) = 28.0 -41
  43. (8 3 5.5 4.5 2.5 1.5) x (0 5 0.0909091 1.22222 1.2 2.66667) = 28.0 -42
  44. (8 3 5.5 4.5 2.5 1.5) x (0 5 0.0909091 0.222222 4.2 0.666667) = 28.0 -43
  45. (8 3 5.5 4.5 2.5 1.5) x (0 5 0.0909091 0.222222 1.2 5.66667) = 28.0 -44
  46. (8 3 5.5 4.5 2.5 1.5) x (0 4 1.09091 2.22222 0 0) = 28.0 -45
  47. (8 3 5.5 4.5 2.5 1.5) x (0 4 1.09091 1.22222 0.2 2.66667) = 28.0 -46
  48. (8 3 5.5 4.5 2.5 1.5) x (0 4 1.09091 0.222222 3.2 0.666667) = 28.0 -47
  49. (8 3 5.5 4.5 2.5 1.5) x (0 4 1.09091 0.222222 0.2 5.66667) = 28.0 -48
  50. (8 3 5.5 4.5 2.5 1.5) x (0 4 0.0909091 2.22222 1.2 1.66667) = 28.0 -49
  51. (8 3 5.5 4.5 2.5 1.5) x (0 4 0.0909091 1.22222 1.2 4.66667) = 28.0 -50
  52. (8 3 5.5 4.5 2.5 1.5) x (0 4 0.0909091 0.222222 4.2 2.66667) = 28.0 -51
  53. (8 3 5.5 4.5 2.5 1.5) x (0 4 0.0909091 0.222222 1.2 7.66667) = 28.0 -52
  54. (8 3 5.5 4.5 2.5 1.5) x (0 3 2.09091 0.222222 2.2 0.666667) = 28.0 -53
  55. (8 3 5.5 4.5 2.5 1.5) x (0 3 1.09091 2.22222 0.2 1.66667) = 28.0 -54
  56. (8 3 5.5 4.5 2.5 1.5) x (0 3 1.09091 1.22222 0.2 4.66667) = 28.0 -55
  57. (8 3 5.5 4.5 2.5 1.5) x (0 3 1.09091 0.222222 3.2 2.66667) = 28.0 -56
  58. (8 3 5.5 4.5 2.5 1.5) x (0 3 1.09091 0.222222 0.2 7.66667) = 28.0 -57
  59. (8 3 5.5 4.5 2.5 1.5) x (0 3 0.0909091 3.22222 1.2 0.666667) = 28.0 -58
  60. (8 3 5.5 4.5 2.5 1.5) x (0 3 0.0909091 2.22222 1.2 3.66667) = 28.0 -59
  61. (8 3 5.5 4.5 2.5 1.5) x (0 3 0.0909091 1.22222 4.2 1.66667) = 28.0 -60
  62. (8 3 5.5 4.5 2.5 1.5) x (0 3 0.0909091 1.22222 1.2 6.66667) = 28.0 -61
  63. (8 3 5.5 4.5 2.5 1.5) x (0 3 0.0909091 0.222222 4.2 4.66667) = 28.0 -62
  64. (8 3 5.5 4.5 2.5 1.5) x (0 3 0.0909091 0.222222 1.2 9.66667) = 28.0 -63
  65. (8 3 5.5 4.5 2.5 1.5) x (0 2 2.09091 0.222222 2.2 2.66667) = 28.0 -64
  66. (8 3 5.5 4.5 2.5 1.5) x (0 2 1.09091 3.22222 0.2 0.666667) = 28.0 -65
  67. (8 3 5.5 4.5 2.5 1.5) x (0 2 1.09091 2.22222 0.2 3.66667) = 28.0 -66
  68. (8 3 5.5 4.5 2.5 1.5) x (0 2 1.09091 1.22222 3.2 1.66667) = 28.0 -67
  69. (8 3 5.5 4.5 2.5 1.5) x (0 2 1.09091 1.22222 0.2 6.66667) = 28.0 -68
  70. (8 3 5.5 4.5 2.5 1.5) x (0 2 1.09091 0.222222 3.2 4.66667) = 28.0 -69
  71. (8 3 5.5 4.5 2.5 1.5) x (0 2 1.09091 0.222222 0.2 9.66667) = 28.0 -70
  72. (8 3 5.5 4.5 2.5 1.5) x (0 2 0.0909091 3.22222 1.2 2.66667) = 28.0 -71
  73. (8 3 5.5 4.5 2.5 1.5) x (0 2 0.0909091 2.22222 4.2 0.666667) = 28.0 -72
  74. (8 3 5.5 4.5 2.5 1.5) x (0 2 0.0909091 2.22222 1.2 5.66667) = 28.0 -73
  75. (8 3 5.5 4.5 2.5 1.5) x (0 2 0.0909091 1.22222 4.2 3.66667) = 28.0 -74
  76. (8 3 5.5 4.5 2.5 1.5) x (0 2 0.0909091 1.22222 1.2 8.66667) = 28.0 -75
  77. (8 3 5.5 4.5 2.5 1.5) x (0 2 0.0909091 0.222222 8.2 0) = 28.0 -76
  78. (8 3 5.5 4.5 2.5 1.5) x (0 2 0.0909091 0.222222 4.2 6.66667) = 28.0 -77
  79. (8 3 5.5 4.5 2.5 1.5) x (0 2 0.0909091 0.222222 1.2 11.6667) = 28.0 -78
  80. (8 3 5.5 4.5 2.5 1.5) x (0 1 3.09091 0.222222 1.2 2.66667) = 28.0 -79
  81. (8 3 5.5 4.5 2.5 1.5) x (0 1 2.09091 1.22222 2.2 1.66667) = 28.0 -80
  82. (8 3 5.5 4.5 2.5 1.5) x (0 1 2.09091 0.222222 2.2 4.66667) = 28.0 -81
  83. (8 3 5.5 4.5 2.5 1.5) x (0 1 1.09091 4.22222 0 0) = 28.0 -82
  84. (8 3 5.5 4.5 2.5 1.5) x (0 1 1.09091 3.22222 0.2 2.66667) = 28.0 -83
  85. (8 3 5.5 4.5 2.5 1.5) x (0 1 1.09091 2.22222 3.2 0.666667) = 28.0 -84
  86. (8 3 5.5 4.5 2.5 1.5) x (0 1 1.09091 2.22222 0.2 5.66667) = 28.0 -85
  87. (8 3 5.5 4.5 2.5 1.5) x (0 1 1.09091 1.22222 3.2 3.66667) = 28.0 -86
  88. (8 3 5.5 4.5 2.5 1.5) x (0 1 1.09091 1.22222 0.2 8.66667) = 28.0 -87
  89. (8 3 5.5 4.5 2.5 1.5) x (0 1 1.09091 0.222222 7.2 0) = 28.0 -88
  90. (8 3 5.5 4.5 2.5 1.5) x (0 1 1.09091 0.222222 6.2 1.66667) = 28.0 -89
  91. (8 3 5.5 4.5 2.5 1.5) x (0 1 1.09091 0.222222 3.2 6.66667) = 28.0 -90
  92. (8 3 5.5 4.5 2.5 1.5) x (0 1 1.09091 0.222222 0.2 11.6667) = 28.0 -91
  93. (8 3 5.5 4.5 2.5 1.5) x (0 1 0.0909091 4.22222 1.2 1.66667) = 28.0 -92
  94. (8 3 5.5 4.5 2.5 1.5) x (0 1 0.0909091 3.22222 1.2 4.66667) = 28.0 -93
  95. (8 3 5.5 4.5 2.5 1.5) x (0 1 0.0909091 2.22222 4.2 2.66667) = 28.0 -94
  96. (8 3 5.5 4.5 2.5 1.5) x (0 1 0.0909091 2.22222 1.2 7.66667) = 28.0 -95
  97. (8 3 5.5 4.5 2.5 1.5) x (0 1 0.0909091 1.22222 4.2 5.66667) = 28.0 -96
  98. (8 3 5.5 4.5 2.5 1.5) x (0 1 0.0909091 1.22222 1.2 10.6667) = 28.0 -97
  99. (8 3 5.5 4.5 2.5 1.5) x (0 1 0.0909091 0.222222 4.2 8.66667) = 28.0 -98
  100. (8 3 5.5 4.5 2.5 1.5) x (0 1 0.0909091 0.222222 1.2 13.6667) = 28.0 -99
  101. (8 3 5.5 4.5 2.5 1.5) x (0 0 5.09091 0 0 0) = 28.0 -100
  102. (8 3 5.5 4.5 2.5 1.5) x (0 0 4.09091 1.22222 0 0) = 28.0 -101
  103. (8 3 5.5 4.5 2.5 1.5) x (0 0 4.09091 0.222222 0.2 2.66667) = 28.0 -102
  104. (8 3 5.5 4.5 2.5 1.5) x (0 0 3.09091 1.22222 1.2 1.66667) = 28.0 -103
  105. (8 3 5.5 4.5 2.5 1.5) x (0 0 3.09091 0.222222 1.2 4.66667) = 28.0 -104
  106. (8 3 5.5 4.5 2.5 1.5) x (0 0 2.09091 2.22222 2.2 0.666667) = 28.0 -105
  107. (8 3 5.5 4.5 2.5 1.5) x (0 0 2.09091 1.22222 2.2 3.66667) = 28.0 -106
  108. (8 3 5.5 4.5 2.5 1.5) x (0 0 2.09091 0.222222 5.2 1.66667) = 28.0 -107
  109. (8 3 5.5 4.5 2.5 1.5) x (0 0 2.09091 0.222222 2.2 6.66667) = 28.0 -108
  110. (8 3 5.5 4.5 2.5 1.5) x (0 0 1.09091 4.22222 0.2 1.66667) = 28.0 -109
  111. (8 3 5.5 4.5 2.5 1.5) x (0 0 1.09091 3.22222 0.2 4.66667) = 28.0 -110
  112. (8 3 5.5 4.5 2.5 1.5) x (0 0 1.09091 2.22222 3.2 2.66667) = 28.0 -111
  113. (8 3 5.5 4.5 2.5 1.5) x (0 0 1.09091 2.22222 0.2 7.66667) = 28.0 -112
  114. (8 3 5.5 4.5 2.5 1.5) x (0 0 1.09091 1.22222 6.2 0.666667) = 28.0 -113
  115. (8 3 5.5 4.5 2.5 1.5) x (0 0 1.09091 1.22222 3.2 5.66667) = 28.0 -114
  116. (8 3 5.5 4.5 2.5 1.5) x (0 0 1.09091 1.22222 0.2 10.6667) = 28.0 -115
  117. (8 3 5.5 4.5 2.5 1.5) x (0 0 1.09091 0.222222 6.2 3.66667) = 28.0 -116
  118. (8 3 5.5 4.5 2.5 1.5) x (0 0 1.09091 0.222222 3.2 8.66667) = 28.0 -117
  119. (8 3 5.5 4.5 2.5 1.5) x (0 0 1.09091 0.222222 0.2 13.6667) = 28.0 -118
  120. (8 3 5.5 4.5 2.5 1.5) x (0 0 0.0909091 5.22222 1.2 0.666667) = 28.0 -119
  121. (8 3 5.5 4.5 2.5 1.5) x (0 0 0.0909091 4.22222 1.2 3.66667) = 28.0 -120
  122. (8 3 5.5 4.5 2.5 1.5) x (0 0 0.0909091 3.22222 4.2 1.66667) = 28.0 -121
  123. (8 3 5.5 4.5 2.5 1.5) x (0 0 0.0909091 3.22222 1.2 6.66667) = 28.0 -122
  124. (8 3 5.5 4.5 2.5 1.5) x (0 0 0.0909091 2.22222 4.2 4.66667) = 28.0 -123
  125. (8 3 5.5 4.5 2.5 1.5) x (0 0 0.0909091 2.22222 1.2 9.66667) = 28.0 -124
  126. (8 3 5.5 4.5 2.5 1.5) x (0 0 0.0909091 1.22222 4.2 7.66667) = 28.0 -125
  127. (8 3 5.5 4.5 2.5 1.5) x (0 0 0.0909091 1.22222 1.2 12.6667) = 28.0 -126
  128. (8 3 5.5 4.5 2.5 1.5) x (0 0 0.0909091 0.222222 4.2 10.6667) = 28.0 -127
  129. (8 3 5.5 4.5 2.5 1.5) x (0 0 0.0909091 0.222222 1.2 15.6667) = 28.0 -128
  130. Completion time :0.25seconds
  131.  
« Last Edit: December 21, 2021, 09:39:27 AM by well20152016 »

well20152016

  • Newt
  • Posts: 130
Re: Find the result n1 m1 n2 m2
« Reply #12 on: December 21, 2021, 09:51:26 AM »
Increase difficulty
Max. 28
Min. 26

get 26 ~ 28 All
(test2 28 26 '(8 3 5.5 4.5 2.5 1.5 ))
« Last Edit: December 21, 2021, 10:13:22 AM by well20152016 »

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Find the result n1 m1 n2 m2
« Reply #13 on: December 21, 2021, 02:26:17 PM »
@ LeeMac, this looks similar to your "give change" challenge. I wonder if we can use here some of the ideas.

You're right - it's essentially solving the same problem, though, listing all possibilities (all ways of giving change) instead of returning only the solution with the lowest variable values (i.e. fewest coins).

well20152016

  • Newt
  • Posts: 130
Re: Find the result n1 m1 n2 m2
« Reply #14 on: December 21, 2021, 05:57:43 PM »
My level is not good. Modify the Stefan code.
Code - HTML5: [Select]
  1.  (test2 28 26'(8 3 5.5 4.5 2.5 1.5))
  2. (8 3 5.5 4.5 2.5 1.5) x (2 1 0 2 0 0) = 28.0 -1            (2 1 0 2 0 0)=5
  3. (8 3 5.5 4.5 2.5 1.5) x (1 0 2 2 0 0) = 28.0 -2            (1 0 2 2 0 0)=5
  4. (8 3 5.5 4.5 2.5 1.5) x (2 4 0 0 0 0) = 28.0 -3
  5. (8 3 5.5 4.5 2.5 1.5) x (2 0 0 2 0 2) = 28.0 -4
  6. (8 3 5.5 4.5 2.5 1.5) x (2 0 0 1 3 0) = 28.0 -5
  7. .......
  8. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 0 5 9) = 26.0 -776
  9. (8 3 5.5 4.5 2.5 1.5) x (0 1 0 0 2 12) = 26.0 -777
  10. (8 3 5.5 4.5 2.5 1.5) x (0 0 0 0 2 14) = 26.0 -778
  11. Completion time :2.96seconds
  12.  



 
« Last Edit: December 30, 2021, 05:50:42 PM by well20152016 »