Again FWIW,   I _did_ use an array for this problem,  which
allows an all-at-once solution.  There are only two colours!

Whether it's my lack of ingenuity or otherwise,  I find I need
to resort more to explicit loops for the later Euler problems
than for the earlier ones.

Mike

On 20/10/2011 2:21 PM, David Vaughan wrote:
> I find it interesting how different my approach has to be if I want a J 
> solution compared to a C or Java solution. I often try to impose my 
> imperative version onto J and start getting stuck trying to express it, such 
> as in this case. I often find that I can't really use J for the solution 
> because of the size of the array I'd have to create / or in general the 
> memory required - I'm sure there's some other way round it.
>
> On 20 Oct 2011, at 13:21, Mike Day wrote:
>
>> Yes, I'm sure it is Euler 121.   I don't think the actual answer has been
>> posted in this thread,  so that's ok.
>>
>> FWIW,  my solution (a few years old, now) appears not to have used
>> the comb verb.   On this machine, it runs in ~0.05 sec using  ~1MB of
>> space.
>>
>> I wish all my Euler solutions were as nifty.
>>
>> Mike
>>
>> On 20/10/2011 8:07 AM, Nick Simicich wrote:
>>> Is this euler 121?
>>>
>>> On Wed, Oct 19, 2011 at 6:24 PM, David Vaughan<[email protected]
>>>> wrote:
>>>> Thanks, this was the method I had envisaged. I wasn't thinking about it in
>>>> the J way originally - this is something I'm trying to work on.
>>>>
>>>>
>> ..........[ I've snipped the rest - Mike]
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to