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
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+...@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
put 100 into n
put n * (n + 1) * (2 * n - 2) / 6 into total
;)
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
Ian Macphail wrote:
put 100 into n
put n * (n + 1) * (2 * n - 2) / 6 into total
;)
_
Oops! forgot it was the square of the sum.
put 100 into n
put n * (n + 1) / 2 into a
put n * (n + 1) * (2 * n + 1) / 6 into b
put a * a - b into total
or which is a prime up to about the square of that. This
one took more time to display the results than to calculate them.
- Mick
Date: Wed, 24 Feb 2010 12:01:17 -0600
From: Geoff Canyon Rev gcanyon+...@gmail.com
Subject: Re: Project Euler [SPOILER #3]
To: How to use Revolution use-revolution
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 bri...@qldlearning.com wrote:
I'm pretty proud of this one for #3... SPOILER ALERT SPOILER ALERT...
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,
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