Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Re: Arithmetic Puzzle (so simple it's hard)


Yes indeed, but this is still "brute force", and that is what Janos  
wrote he lacks rather than functional programming skills. He tried to  
use intelligence (in this case a genetic algorithm) as did Daniel  
Lichtblau. The trouble is that this is the sort of problem where  
brute force always wins and intelligence comes off badly beaten up.  
It's like fighting a battle on a complete plain field, with no hills,  
rivers, or anything else that you can use to make up for the enemy's  
superior numbers; even Hannibal, Caesar or Napoleon would be  
helpless. In that sense it is indeed "so simple that it's hard".

Andrzej Kozlowski



On 25 Nov 2006, at 19:37, croddie at princeton.edu wrote:

> Janos: get used to functional programming!
>
> Simple program, not too slow; plus you can read and understand it:
>
> doesitwork[partition_] :=
>      Module[{b, u, t, a, s, k, f, e},
>                 {b, u, t, a, s, k, f, e} = partition;
>                 (100b + 10u +t)(100a + 10s + k) == 10000f + 1000e +
> 100a + 10s + t];
> Timing[Select [Permutations[{0, 1, 2, 4, 5, 6, 7, 9}], doesitwork]]
>
> Output:
> {1.578 Second, {{0, 5, 6, 4, 9, 1, 2, 7}, {6, 7, 0, 1, 4, 2, 9, 5}}}
>
>
> János wrote:
>
>> Any suggestions to make it faster would be highly appreciated.  /It
>> took 526 seconds to run with above parameters/
>>
>> János
>> On Nov 14, 2006, at 5:06 AM, Bruce Colletti wrote:
>>
>>> How would this problem be solved in Mathematica?
>


  • Prev by Date: Re: Re: Method option to Solve
  • Next by Date: Integration (change of variable)
  • Previous by thread: Re: Arithmetic Puzzle (so simple it's hard)
  • Next by thread: Re: Re: Arithmetic Puzzle (so simple it's hard)