MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Solve - takes very long time

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121821] Re: Solve - takes very long time
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 4 Oct 2011 01:30:32 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201110030821.EAA08778@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

There are 168 solutions:

Timing[Length[
   solns = FromDigits /@ Partition[#, 3] & /@
     Select[Permutations@
       Range@9, #[[1]] < #[[4]] && #.{100, 10, 1, 100, 10,
           1, -100, -10, -1} == 0 &]]]

{1.50652, 168}

solns

{{124, 659, 783}, {125, 739, 864}, {127, 359, 486}, {127, 368,
   495}, {128, 367, 495}, {128, 439, 567}, {129, 357, 486}, {129, 438,
   567}, {129, 654, 783}, {129, 735, 864}, {134, 658, 792}, {135, 729,
   864}, {138, 429, 567}, {138, 654, 792}, {139, 428, 567}, {139, 725,
   864}, {142, 596, 738}, {142, 695, 837}, {143, 586, 729}, {145, 692,
   837}, {146, 583, 729}, {146, 592, 738}, {152, 487, 639}, {152, 784,
   936}, {154, 629, 783}, {154, 638, 792}, {154, 782, 936}, {157, 329,
   486}, {157, 482, 639}, {158, 634, 792}, {159, 327, 486}, {159, 624,
   783}, {162, 387, 549}, {162, 783, 945}, {163, 782, 945}, {167, 328,
   495}, {167, 382, 549}, {168, 327, 495}, {173, 286, 459}, {173, 295,
   468}, {175, 293, 468}, {176, 283, 459}, {182, 367, 549}, {182, 394,
   576}, {182, 457, 639}, {182, 493, 675}, {182, 754, 936}, {182, 763,
   945}, {183, 276, 459}, {183, 492, 675}, {183, 546, 729}, {183, 762,
   945}, {184, 392, 576}, {184, 752, 936}, {186, 273, 459}, {186, 543,
   729}, {187, 362, 549}, {187, 452, 639}, {192, 384, 576}, {192, 483,
   675}, {192, 546, 738}, {192, 645, 837}, {193, 275, 468}, {193, 482,
   675}, {194, 382, 576}, {195, 273, 468}, {195, 642, 837}, {196, 542,
   738}, {214, 569, 783}, {214, 659, 873}, {215, 478, 693}, {215, 748,
   963}, {216, 378, 594}, {216, 738, 954}, {218, 349, 567}, {218, 376,
   594}, {218, 439, 657}, {218, 475, 693}, {218, 736, 954}, {218, 745,
   963}, {219, 348, 567}, {219, 438, 657}, {219, 564, 783}, {219, 654,
   873}, {234, 657, 891}, {235, 746, 981}, {236, 718, 954}, {236, 745,
   981}, {237, 654, 891}, {238, 419, 657}, {238, 716, 954}, {239, 418,
   657}, {241, 596, 837}, {243, 576, 819}, {243, 675, 918}, {245, 673,
   918}, {245, 718, 963}, {245, 736, 981}, {246, 573, 819}, {246, 591,
   837}, {246, 735, 981}, {248, 319, 567}, {248, 715, 963}, {249, 318,
   567}, {251, 397, 648}, {254, 619, 873}, {254, 637, 891}, {257, 391,
   648}, {257, 634, 891}, {259, 614, 873}, {264, 519, 783}, {269, 514,
   783}, {271, 593, 864}, {271, 683, 954}, {273, 546, 819}, {273, 591,
   864}, {273, 645, 918}, {273, 681, 954}, {275, 418, 693}, {275, 643,
   918}, {276, 318, 594}, {276, 543, 819}, {278, 316, 594}, {278, 415,
   693}, {281, 394, 675}, {281, 673, 954}, {283, 671, 954}, {284, 391,
   675}, {291, 357, 648}, {291, 384, 675}, {291, 546, 837}, {291, 573,
   864}, {293, 571, 864}, {294, 381, 675}, {296, 541, 837}, {297, 351,
   648}, {314, 658, 972}, {317, 529, 846}, {317, 628, 945}, {318, 627,
   945}, {318, 654, 972}, {319, 527, 846}, {324, 567, 891}, {324, 657,
   981}, {327, 519, 846}, {327, 564, 891}, {327, 618, 945}, {327, 654,
   981}, {328, 617, 945}, {329, 517, 846}, {341, 586, 927}, {342, 576,
   918}, {346, 572, 918}, {346, 581, 927}, {352, 467, 819}, {354, 618,
   972}, {354, 627, 981}, {357, 462, 819}, {357, 624, 981}, {358, 614,
   972}, {362, 457, 819}, {364, 527, 891}, {367, 452, 819}, {367, 524,
   891}, {372, 546, 918}, {376, 542, 918}, {381, 546, 927}, {386, 541,
   927}}

Bobby

On Mon, 03 Oct 2011 03:21:54 -0500, Fredob <fredrik.doberl at gmail.com>  
wrote:

> Hi,
>
> I tried the following on Mathematica 8 and it doesn't seem to stop
> running (waited 40 minutes on a 2.6 Ghz processor w 6 GB of primary
> memory).
>
> Solve[
>  {100*Subscript[x, 2] + 10*Subscript[x, 1] + Subscript[x, 0] +
>     100*Subscript[y, 2] + 10*Subscript[y, 1] + Subscript[y, 0] ==
>    100*Subscript[z, 2] + 10*Subscript[z, 1] + Subscript[z, 0],
>    Subscript[x, 0] > 0, Subscript[y, 0] > 0, Subscript[z, 0] > 0,
>   Subscript[x, 1] > 0, Subscript[y, 1] > 0, Subscript[z, 1] > 0,
>   Subscript[x, 2] > 0, Subscript[y, 2] > 0, Subscript[z, 2] > 0,
>   Subscript[x, 0] <= 9, Subscript[y, 0] <= 9, Subscript[z, 0] <= 9,
>   Subscript[x, 1] <= 9, Subscript[y, 1] <= 9, Subscript[z, 1] <= 9,
>   Subscript[x, 2] <= 9, Subscript[y, 2] <= 9, Subscript[z, 2] <= 9,
>   Subscript[x, 0] != Subscript[y, 0] != Subscript[z, 0] != Subscript[
>    x, 1] != Subscript[y, 1] != Subscript[z, 1] != Subscript[x, 2] !=
>    Subscript[y, 2] != Subscript[z, 2]},
>  {Subscript[x, 2], Subscript[y, 2], Subscript[z, 2], Subscript[x, 1],
>   Subscript[y, 1], Subscript[z, 1], Subscript[x, 0], Subscript[y, 0],
>   Subscript[z, 0] },
>  Integers]
>
> The problem was a homework for my daugther where you are supposed to
> use all digits to build - but only once - 2 three digit numbers and
> addition.
>
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: Find a single solution to a system of equations
  • Next by Date: 3d EPS export files huge on Mac OS X, not so much on PCs
  • Previous by thread: Solve - takes very long time
  • Next by thread: Re: Solve - takes very long time