Project Euler [SPOILER #3]

Geoff Canyon Rev gcanyon+rev at gmail.com
Thu Feb 25 10:03:22 EST 2010


Ah, now I understand how yours works -- that _is_ quite clever!

gc

On Thu, Feb 25, 2010 at 8:21 AM, Geoff Canyon Rev <gcanyon+rev at gmail.com> wrote:
> It's hurting my head trying to figure out why yours works. ;-)
>
> That said, it's very slow. The simple brute force method is roughly
> 100 times faster (since it doesn't iterate 10,000 times but only 100):
>
>      put 0 into total
>      put 0 into summer
>      repeat with i = 1 to 100
>         subtract i^2 from total
>         add i to summer
>      end repeat
>      add summer^2 to total
>
> _That_ said, I believe there is yet a faster way. I believe yours is
> O(n^5), mine is O(n^3), but O(n^2) is possible. (If someone
> understands big O notation better than I do feel free to jump in here)
>
> gc
>
> On Wed, Feb 24, 2010 at 1:47 PM, Brian Yennie <briany at qldlearning.com> wrote:
>> No, we're actually talking about #6 =).
>>
>> I put them in order of difficulty and this becomes the 3rd one... but it's actually id 6.
>>
>>> Are we talking about the same #3?
>>>
>>> The prime factors of 13195 are 5, 7, 13 and 29.
>>>
>>> What is the largest prime factor of the number 600851475143 ?
>>>
>>>
>>>
>>> On Tue, Feb 23, 2010 at 11:04 AM, Brian Yennie <briany at qldlearning.com> wrote:
>>>> I'm pretty proud of this one for #3... SPOILER ALERT SPOILER ALERT... scroll down if you want to see. Great site find, Andre!!
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> put 0 into total
>>>> repeat with i=1 to 100
>>>> repeat with j=1 to 100
>>>>    if (i=j) then next repeat
>>>>    add i*j to total
>>>> end repeat
>>>> end repeat
>>>>
>>>> _____
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>



More information about the Use-livecode mailing list