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: [mg121823] Re: Solve - takes very long time
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Tue, 4 Oct 2011 01:30:53 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j6bris$8m4$1@smc.vnet.net>

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: Solve - takes very long time
  • Next by Date: 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