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: [mg121856] Re: Solve - takes very long time
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Wed, 5 Oct 2011 04:00:34 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

The basic condition can be written as 

100*(x2 + y2) + 10*(x1 + y1) + (x0 + y0) = 100*z2 + 10*z1 + z0,

in which form it is clear that we can always swap corresponding xi and
yi, and that solutions therefore come is sets of 8. Requiring xi < yi
for all i is just a way of picking a "canonical" member of each set.

----- DrMajorBob <btreat1 at austin.rr.com> wrote:
> The conditions #[[2]] < #[[5]] and #[[3]] < #[[6]] do not belong, however.
> 
> Bobby
> 
> On Tue, 04 Oct 2011 00:30:53 -0500, Ray Koopman <koopman at sfu.ca> wrote:
> 
>> On Oct 3, 1:26 am, Fredob <fredrik.dob... 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.
>>
>> For each of the 42 solutions found by the brute force search given
>> below there are seven other solutions that may be obtained by
>> interchanging x0,y0 and/or x1,y1 and/or x2,y2.
>>
>> FromDigits/@Partition[#,3]& /@ Select[Permutations@Range@9,
>>   #[[1]] < #[[4]] && #[[2]] < #[[5]] && #[[3]] < #[[6]] &&
>>   #.{100,10,1,100,10,1,-100,-10,-1} == 0 &]
>>
>> {{124,659,783}, {125,739,864}, {127,359,486},
>>  {127,368,495}, {128,439,567}, {134,658,792},
>>  {142,596,738}, {142,695,837}, {143,586,729},
>>  {152,487,639}, {152,784,936}, {162,387,549},
>>  {162,783,945}, {173,286,459}, {173,295,468},
>>  {182,394,576}, {182,493,675}, {214,569,783},
>>  {214,659,873}, {215,478,693}, {215,748,963},
>>  {216,378,594}, {216,738,954}, {218,349,567},
>>  {218,439,657}, {234,657,891}, {235,746,981},
>>  {241,596,837}, {243,576,819}, {243,675,918},
>>  {251,397,648}, {271,593,864}, {271,683,954},
>>  {281,394,675}, {314,658,972}, {317,529,846},
>>  {317,628,945}, {324,567,891}, {324,657,981},
>>  {341,586,927}, {342,576,918}, {352,467,819}}



  • Prev by Date: Re: Compilation: Avoiding inlining
  • Next by Date: Re: Fully vectorized system of ODE's - any advantage of C?
  • Previous by thread: Re: Solve - takes very long time
  • Next by thread: Re: Solve - takes very long time