Re: Project Euler

2010-02-27 Thread Alejandro Tejada


Andre Garzia-3 wrote:
 
 good question,
 
 have you given the revlet network permissions?
 

Yes, , i selected Allow always.

Double click one line in first card and stack go to
next card with all fields empty.

Just noticed that 141 kb takes too
long to load. Does this works the
same in every computer?
Or only in my side?

Same results using Firefox 3.5.8, Internet Explorer 8
and Google Chrome.


-- 
View this message in context: 
http://n4.nabble.com/Project-Euler-tp1566143p1572042.html
Sent from the Revolution - User mailing list archive at Nabble.com.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-27 Thread Brian Yennie
Alejandro,

For me the double-clicking doesn't work at all, but submitting a new solution 
is no problem.
Poor Andre didn't know what he was getting himself into, but...

Any chance Andre you could add a simple edit button on the front page instead 
of the double click? Maybe that would help.


 
 
 Andre Garzia-3 wrote:
 
 good question,
 
 have you given the revlet network permissions?
 
 
 Yes, , i selected Allow always.
 
 Double click one line in first card and stack go to
 next card with all fields empty.
 
 Just noticed that 141 kb takes too
 long to load. Does this works the
 same in every computer?
 Or only in my side?
 
 Same results using Firefox 3.5.8, Internet Explorer 8
 and Google Chrome.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-26 Thread Alejandro Tejada


Robert Brenstein wrote:
 
 revlet loading techniques? All I get is plugin not loaded.
 

On my side of the web, double clicking one
of the names of first card: Solutions Database
shows all fields empty on second card: Test Solution.

Why i am getting this error?

Alejandro 
-- 
View this message in context: 
http://n4.nabble.com/Project-Euler-tp1566143p1571217.html
Sent from the Revolution - User mailing list archive at Nabble.com.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-26 Thread Andre Garzia
good question,

have you given the revlet network permissions?



On Fri, Feb 26, 2010 at 4:37 PM, Alejandro Tejada capellan2...@gmail.comwrote:



 Robert Brenstein wrote:
 
  revlet loading techniques? All I get is plugin not loaded.
 

 On my side of the web, double clicking one
 of the names of first card: Solutions Database
 shows all fields empty on second card: Test Solution.

 Why i am getting this error?

 Alejandro
 --
 View this message in context:
 http://n4.nabble.com/Project-Euler-tp1566143p1571217.html
 Sent from the Revolution - User mailing list archive at Nabble.com.
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution




-- 
http://www.andregarzia.com All We Do Is Code.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-26 Thread Mick Collins
 Mike, 'scool, thanks.

Brian, I agree, great project for math and coding.  Sometimes it's an 
enlightening exercise to take an existing capability and code it oneself or to 
extend it.  For instance, I have written routines to do infinite precision 
integer arithmetic (working on an infinite precision calculator), to do a 
sortof baseConvert, but which will accept decimals or fractions and bases 
larger than 36, intermediately large (10^12+) prime factorization and at one 
time in I wrote some routines to mimic trig functions.  As far as sqrt, back in 
the old days when I was in high school, we learned to extract those by hand ... 
you, too?  



From: Michael Kann mikek...@yahoo.com
Subject: Re: Project Euler
To: How to use Revolution use-revolution@lists.runrev.com
Message-ID: 327364.51145...@web56701.mail.re3.yahoo.com 
Content-Type: text/plain; charset=iso-8859-1
 
Mick, 

You beat me to it on the Fibonacci series. I also thought about using the 
golden ratio. Using a few other relationships allows one to compose a rather 
compact script.

1. the F numbers are always odd odd even, odd odd even
is
--- before four million

2. F1 + F2 + F3 . . . Fn = F(n+2)- 1

--- this allows you to do the summation at the end
--- If you know Fn then you just go up a couple more
--- numbers to get the sum of the first n numbers

3. If you stop the summation at F(even) then the sum of
   the even numbers will be 1/2 of the total sum

-- 1,1,TWO,3,5,EIGHT,13,21,THIRTY-FOUR
-- The two numbers sum to the EVENS (by definition)

Here's the script -- 555 is just any large number

on mouseUp
put (1+ sqrt(5))/2 into g
repeat with n = 0 to 555 step 3
   if (g^n)/sqrt(5)  4E6 then exit repeat 
end repeat 
put (round((g^(n-1))/sqrt(5)) - 1) / 2 
end mouseUp 
-
The golden ratio technique is most valuable if you want to hit a very large F 
number. You don't have to count up to it. It is like random access memory.



Here's another interesting property of a F series:

1 1 2 3 5 8 13 21

Take the square of 8 -- 64. It is off by one from the product 5*13. That holds 
for any 3 numbers in a row. Sometimes the square is one more than the products 
of its neighbors, sometimes one less: but always one off.  


**
Date: Thu, 25 Feb 2010 16:27:38 -0500
From: Brian Yennie bri...@qldlearning.com
Subject: Re: Project Euler
To: How to use Revolution use-revolution@lists.runrev.com
Message-ID: a4db603e-27d8-4404-b01d-8d24b9b97...@qldlearning.com
Content-Type: text/plain; charset=us-ascii

Good stuff! I particularly like this project, because it allows for a 
combination of clever coding AND pure math. The best problems surely require 
both. It also depends what level of computation you force yourself to 
contain in you code. For example, Rev has a sqrt() function, but what if you 
had to write this code without that function built in? Would that lead to a 
whole different approach? Is it ok to use known formulas, or does your code 
have to derive them itself? Etc.

With that said, it would be pretty darn cool if we got a near-complete set of 
solutions all written in Rev... what a nice reference for tight mathematical 
coding.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler [SPOILER #3]

2010-02-25 Thread Geoff Canyon Rev
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 bri...@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 bri...@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@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler [SPOILER #3]

2010-02-25 Thread Geoff Canyon Rev
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 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 bri...@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 bri...@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@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler [SPOILER #3]

2010-02-25 Thread Ian Macphail

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:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler [SPOILER #3]

2010-02-25 Thread Ian Macphail

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
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler [SPOILER #3]

2010-02-25 Thread Mick Collins
600851475143 = 71* 839 * 1471 * 6857

It's factors are 1, 71, 839, 1471, 6857, 59569, 104441, 486847, 1234169, 
5753023, 10086647, 87625999, 408464633, 716151937, 8462696833,  and 600851475143

I wrote a stack that will do this for any number whose largest prime factor is 
around 100,000,000 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@lists.runrev.com
Message-ID:
   8ea148a01002241001h68210441i388f66f67ba71...@mail.gmail.com
Content-Type: text/plain; charset=ISO-8859-1

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 ?




___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-25 Thread Mick Collins
First, thanks, Andre for starting the thread and turning us / me onto the Euler 
Project.

I enjoy implementing algorithms, but math is fun, too!
Since Euler was a mathematician, how about a more mathematical approach.



I haven't seen these approaches yet in my quick scan of  the posts, so I will 
put them out there:

For the first problem
*** mathematical note
The number of natural numbers below X that are divisible by 3 or 5 is:
the number divisible by 3, plus the number divisible by 5, minus the number 
divisible by 15 (since these number have already been counted twice).
For combining in a more general fashion, i.e. other than 3 and 5, rather than 
using the multiple you would use the Least Common Multiple (not implemented 
here).  For instance, if you wanted the number divisible by 6 or 4, you would 
use numdiv(4) + numdiv(6) - numdiv(12), since if you used numdiv(24) you would 
miss subtracting off many numbers divisible by both 4 and 6 but not by 24 
(12*1, 12*3, 12*5 ...)

Here is a testing routine, followed by a generalization of the problem (no 
error correction).  For the testing routine, as soon as you are satisfied that 
it works as advertised, hold the shift key to jump out of the loop.  Then it 
will display the results of divisibility by 3 or 5.

on doTest
   repeat until the shiftkey is down
  ask X with 1000
  put it into X
  ask N with 3
  put it into N
  answer = or plain  with Eq or NoEq 
  put it into EorNo
  put numOfNumsBelowXandDivisByN(X,N,EorNo) into theResult
  if EorNo is NoEq then
 put Number  [[X]] and divisible by [[N]] is [[theResult]]. into 
mergeStr
  else 
 put Number = [[X]] and divisible by [[N]] is [[theResult]]. into 
mergeStr
  end if
  answer merge(mergeStr)
   end repeat
   
   put 1000 into X
   put NoEq into EorNo
   put 3 into N
   put numOfNumsBelowXandDivisByN(X,N,EorNo) into theResult3
   put 5 into N
   put numOfNumsBelowXandDivisByN(X,N,EorNo) into theResult5
   put 15 into N
   put numOfNumsBelowXandDivisByN(X,N,EorNo) into theResult15
   put Number  [[X]] and divisible by 3 or 5 is   \
   [[theResult3 + theResult5 - theResult15]]. into mergeStr
   answer merge(mergeStr)
end doTest



function numOfNumsBelowXandDivisByN X,N, EqOrNoEq
   put X into X_
   put X_ mod N into XmodN   
   -- X div N will be the number returned EXCEPT ...
   if EqOrNoEq = NoEq and XmodN = 0 then   -- X divisible by N and it matters
  subtract 1 from X_   end if
  return X_ div N
end numOfNumsBelowXandDivisByN 





For the second problem
**
The even Fibonacci numbers form a Fibonacci-like sequence
E(1) = 0, E(2) = 2, for n2: E(n) = 4E(n-1) + E(2)
0, 2, 8, 34, 144, 610, 2584, etc.
Also, the sums of the even Fibs form a slightly less Fibonacci-like sequence
S(1) = 0, S(2)=2, S(3) = 10,  for n3: S(n) = 5*S(n-1) - 3*S(n-2) - S(n-3)
0, 2, 10, 44, 188, 798, 3382, etc.
 
There may be an even more direct approach to one or both of these sequences 
(I don't know if there is), such as with the plain vanilla (no offense 
intended) Fibonacci sequence.  
The i-th member of the sequence is:
(g^i-(-1/g)^i) / rt5 where rt5 is the square root of 5 and g is the golden 
ratio: (  (1+rt5)/2  ).  
So that sequence can be calculated explicitly (rather than recursively).

In the testing routine, I start by displaying the explicit calculation of the 
first
8 members of the Fibonacci sequence

Then the recursive method of the even Fibs, keeping track of the sums.
Then the recursive method of the sums, only using the even Fibs, by calculation
to test whether to stop.


on doTest
   put sqrt(5) into rt5
   put (1+rt5)/2 into g
   repeat with i = 1 to 8
  put (g^i-(-1/g)^i) / rt5 into theF
  answer theF
   end repeat
   
   -- even Fibs sums by first method

   answer First Method
   put 2 into F1
   put 8 into F2
   put 10 into theSum
   repeat while F2 = 400
  put 4*F2 + F1 into newFib
  add newFib to theSum
  put F2 into F1
  put newFib into F2
   end repeat
   answer Fib  F1  ,   Sum  theSum


   answer Second Method
   
   put 0 into S1
   put 2 into S2
   put 10 into S3
   repeat while S3 - S2 = 400
  put 5*S3 - 3*S2 - S1 into newFib
  put S2 into S1
  put S3 into S2
  put newFib into S3
   end repeat
   answerSum  S3
end doTest

I'd welcome any comments on these.


Date: Tue, 23 Feb 2010 13:28:37 -0300
From: Andre Garzia an...@andregarzia.com
Subject: Project Euler
To: How to use Revolution use-revolution@lists.runrev.com
Message-ID:
   7c87a2a11002230828ia2f0ff1s399ab3ae1b2d0...@mail.gmail.com
Content-Type: text/plain; charset=ISO-8859-1

Hi There Folks,

I don't know if you guys are familiar with http://www.projecteuler.net which
is officially a very fun project according to my own concepts of fun. It is
a repository of mathematical problems which require more than simple math to
solve, it usually require some programming. You can go 

Re: Project Euler

2010-02-25 Thread Michael Kann
Mick, 

You beat me to it on the Fibonacci series. I also thought about using the 
golden ratio. Using a few other relationships allows one to compose a rather 
compact script.

1. the F numbers are always odd odd even, odd odd even

--- this allows you to use step 3 in the loop
--- you will only check even numbers and stop at the last one
--- before four million

2. F1 + F2 + F3 . . . Fn = F(n+2)- 1

--- this allows you to do the summation at the end
--- If you know Fn then you just go up a couple more
--- numbers to get the sum of the first n numbers

3. If you stop the summation at F(even) then the sum of
   the even numbers will be 1/2 of the total sum

-- 1,1,TWO,3,5,EIGHT,13,21,THIRTY-FOUR
-- The two numbers sum to the EVENS (by definition)

Here's the script -- 555 is just any large number

on mouseUp
put (1+ sqrt(5))/2 into g
repeat with n = 0 to 555 step 3
   if (g^n)/sqrt(5)  4E6 then exit repeat 
end repeat 
put (round((g^(n-1))/sqrt(5)) - 1) / 2 
end mouseUp 
-
The golden ratio technique is most valuable if you want to hit a very large F 
number. You don't have to count up to it. It is like random access memory.



Here's another interesting property of a F series:

1 1 2 3 5 8 13 21

Take the square of 8 -- 64. It is off by one from the product 5*13. That holds 
for any 3 numbers in a row. Sometimes the square is one more than the products 
of its neighbors, sometimes one less: but always one off.  



--- On Thu, 2/25/10, Mick Collins mickc...@mac.com wrote:

 From: Mick Collins mickc...@mac.com
 Subject: Re: Project Euler
 To: use-revolution@lists.runrev.com
 Date: Thursday, February 25, 2010, 2:13 PM
 First, thanks, Andre for starting the
 thread and turning us / me onto the Euler Project.
 
 I enjoy implementing algorithms, but math is fun, too!
 Since Euler was a mathematician, how about a more
 mathematical approach.
 
 
 
 I haven't seen these approaches yet in my quick scan
 of  the posts, so I will put them out there:
 
 For the first problem
 *** mathematical note
 The number of natural numbers below X that are divisible by
 3 or 5 is:
 the number divisible by 3, plus the number divisible by 5,
 minus the number divisible by 15 (since these number have
 already been counted twice).
 For combining in a more general fashion, i.e. other than 3
 and 5, rather than using the multiple you would use the
 Least Common Multiple (not implemented here).  For
 instance, if you wanted the number divisible by 6 or 4, you
 would use numdiv(4) + numdiv(6) - numdiv(12), since if you
 used numdiv(24) you would miss subtracting off many numbers
 divisible by both 4 and 6 but not by 24 (12*1, 12*3, 12*5
 ...)
 
 Here is a testing routine, followed by a generalization of
 the problem (no error correction).  For the testing
 routine, as soon as you are satisfied that it works as
 advertised, hold the shift key to jump out of the
 loop.  Then it will display the results of divisibility
 by 3 or 5.
 
 on doTest
    repeat until the shiftkey is down
       ask X with 1000
       put it into X
       ask N with 3
       put it into N
       answer = or plain  with Eq
 or NoEq 
       put it into EorNo
       put
 numOfNumsBelowXandDivisByN(X,N,EorNo) into theResult
       if EorNo is NoEq then
          put Number 
 [[X]] and divisible by [[N]] is [[theResult]]. into
 mergeStr
       else 
          put Number =
 [[X]] and divisible by [[N]] is [[theResult]]. into
 mergeStr
       end if
       answer merge(mergeStr)
    end repeat
    
    put 1000 into X
    put NoEq into EorNo
    put 3 into N
    put numOfNumsBelowXandDivisByN(X,N,EorNo)
 into theResult3
    put 5 into N
    put numOfNumsBelowXandDivisByN(X,N,EorNo)
 into theResult5
    put 15 into N
    put numOfNumsBelowXandDivisByN(X,N,EorNo)
 into theResult15
    put Number  [[X]] and divisible by 3
 or 5 is   \
            
    [[theResult3 + theResult5 -
 theResult15]]. into mergeStr
    answer merge(mergeStr)
 end doTest
 
 
 
 function numOfNumsBelowXandDivisByN X,N, EqOrNoEq
    put X into X_
    put X_ mod N into
 XmodN   
    -- X div N will be the number returned
 EXCEPT ...
    if EqOrNoEq = NoEq and XmodN = 0
 then   -- X divisible by N and it matters
       subtract 1 from
 X_   end if
       return X_ div N
 end numOfNumsBelowXandDivisByN 
 
 
 
 
 
 For the second problem
 **
 The even Fibonacci numbers form a Fibonacci-like sequence
 E(1) = 0, E(2) = 2, for n2: E(n) = 4E(n-1) + E(2)
 0, 2, 8, 34, 144, 610, 2584, etc.
 Also, the sums of the even Fibs form a slightly less
 Fibonacci-like sequence
 S(1) = 0, S(2)=2, S(3) = 10,  for n3: S(n) =
 5*S(n-1) - 3*S(n-2) - S(n-3)
 0, 2, 10, 44, 188, 798, 3382, etc.
  
 There may be an even more direct approach to one or both of
 these sequences 
 (I don't know if there is), such as with the plain vanilla
 (no offense intended) Fibonacci sequence.  
 The i-th member of the sequence is:
 (g^i-(-1/g)^i) / rt5 where rt5 is the square root

Re: Project Euler

2010-02-25 Thread Brian Yennie
Good stuff! I particularly like this project, because it allows for a 
combination of clever coding AND pure math. The best problems surely require 
both. It also depends what level of computation you force yourself to contain 
in you code. For example, Rev has a sqrt() function, but what if you had to 
write this code without that function built in? Would that lead to a whole 
different approach? Is it ok to use known formulas, or does your code have to 
derive them itself? Etc.

With that said, it would be pretty darn cool if we got a near-complete set of 
solutions all written in Rev... what a nice reference for tight mathematical 
coding.

 Mick, 
 
 You beat me to it on the Fibonacci series. I also thought about using the 
 golden ratio. Using a few other relationships allows one to compose a rather 
 compact script.
 
 1. the F numbers are always odd odd even, odd odd even
 
 --- this allows you to use step 3 in the loop
 --- you will only check even numbers and stop at the last one
 --- before four million
 
 2. F1 + F2 + F3 . . . Fn = F(n+2)- 1
 
 --- this allows you to do the summation at the end
 --- If you know Fn then you just go up a couple more
 --- numbers to get the sum of the first n numbers
 
 3. If you stop the summation at F(even) then the sum of
   the even numbers will be 1/2 of the total sum
 
 -- 1,1,TWO,3,5,EIGHT,13,21,THIRTY-FOUR
 -- The two numbers sum to the EVENS (by definition)
 
 Here's the script -- 555 is just any large number
 
 on mouseUp
 put (1+ sqrt(5))/2 into g
 repeat with n = 0 to 555 step 3
   if (g^n)/sqrt(5)  4E6 then exit repeat 
 end repeat 
 put (round((g^(n-1))/sqrt(5)) - 1) / 2 
 end mouseUp 
 -
 The golden ratio technique is most valuable if you want to hit a very large F 
 number. You don't have to count up to it. It is like random access memory.
 
 
 
 Here's another interesting property of a F series:
 
 1 1 2 3 5 8 13 21
 
 Take the square of 8 -- 64. It is off by one from the product 5*13. That 
 holds for any 3 numbers in a row. Sometimes the square is one more than the 
 products of its neighbors, sometimes one less: but always one off.  

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-24 Thread Geoff Canyon Rev
I did about eighty project euler problems in rev about three years
ago. In the process I wrote my own bignum library and many other
utility routines. I don't know that any of it was release-worthy, or
if I have the stacks anymore. Then I switched to coding in J (which
has built-in unlimited precision integers).

One thing to consider is that project euler specifically discourages
sharing code before you've come up with your own answer. At the site
you can't get help, or even enter the forum for a problem, until
you've solved it yourself.

gc

On Tue, Feb 23, 2010 at 4:04 PM, Robert Brenstein r...@robelko.com wrote:
 On 23.02.10 at 15:54 -0300 Andre Garzia apparently wrote:

 Done!

 checkout

 http://wecode.org/euler

 you need RevWeb plugin for that.

 Cheers
 andre
 PS: check the source code to see some uberpretty revlet loading
 techniques!



 revlet loading techniques? All I get is plugin not loaded.

 Robert
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler [SPOILER #3]

2010-02-24 Thread Geoff Canyon Rev
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... 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@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler [SPOILER #3]

2010-02-24 Thread Brian Yennie
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 bri...@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-23 Thread Mark Schonewille

Andre,

on mouseUp
 put 0,1 into mySequence
 put 0 into mySum
 repeat
  put the last item of mySequence into myCurrentNumber
  if myCurrentNumber  4E6 then
   if myCurrentNumber mod 2 is 0 then add myCurrentNumber  
to mySum
   put myCurrentNumber  comma  (item 1 of mySequence +  
myCurrentNumber) into mySequence

  else exit repeat
 end repeat
 put mySum
end mouseUp

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer

Economy-x-Talk is always looking for new software development  
projects. Feel free to contact me for a quote.


Op 23 feb 2010, om 17:28 heeft Andre Garzia het volgende geschreven:


Hi There Folks,

I don't know if you guys are familiar with http:// 
www.projecteuler.net which
is officially a very fun project according to my own concepts of  
fun. It is
a repository of mathematical problems which require more than simple  
math to
solve, it usually require some programming. You can go solving your  
problems

and getting scores. I just solved the first one in Rev.

Add all the natural numbers below one thousand that are multiples  
of 3 or

5.

Now, the second one is giving me trouble... rsrsrsrs

Find the sum of all the even-valued terms in the Fibonacci sequence  
which

do not exceed four million.

I think I am going to reach the upper limits of rev math with it.

:D


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-23 Thread Andre Garzia
Mark,

you're the man! I was doing something so complex that I can't believe
myself! That is very elegant, I like the way you replace the sequence, I was
keeping them all doing lots of loops.

Thanks for this solution! wonderful! :D

Cheers
andre

On Tue, Feb 23, 2010 at 1:49 PM, Mark Schonewille 
m.schonewi...@economy-x-talk.com wrote:

 Andre,

 on mouseUp
 put 0,1 into mySequence
 put 0 into mySum
 repeat
  put the last item of mySequence into myCurrentNumber
  if myCurrentNumber  4E6 then
   if myCurrentNumber mod 2 is 0 then add myCurrentNumber to
 mySum
   put myCurrentNumber  comma  (item 1 of mySequence +
 myCurrentNumber) into mySequence
  else exit repeat
 end repeat
 put mySum
 end mouseUp

 --
 Best regards,

 Mark Schonewille

 Economy-x-Talk Consulting and Software Engineering
 Homepage: http://economy-x-talk.com
 Twitter: http://twitter.com/xtalkprogrammer

 Economy-x-Talk is always looking for new software development projects.
 Feel free to contact me for a quote.

 Op 23 feb 2010, om 17:28 heeft Andre Garzia het volgende geschreven:


  Hi There Folks,

 I don't know if you guys are familiar with http://www.projecteuler.netwhich
 is officially a very fun project according to my own concepts of fun. It
 is
 a repository of mathematical problems which require more than simple math
 to
 solve, it usually require some programming. You can go solving your
 problems
 and getting scores. I just solved the first one in Rev.

 Add all the natural numbers below one thousand that are multiples of 3 or
 5.

 Now, the second one is giving me trouble... rsrsrsrs

 Find the sum of all the even-valued terms in the Fibonacci sequence which
 do not exceed four million.

 I think I am going to reach the upper limits of rev math with it.

 :D


 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution




-- 
http://www.andregarzia.com All We Do Is Code.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler [SPOILER #3]

2010-02-23 Thread Brian Yennie
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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-23 Thread Bob Sneidar
I was just about to say the same thing! ;-) Mark, you should post your 
solution, and quick! Otherwise Andre is going to do it! (j/k)

Bob


On Feb 23, 2010, at 8:49 AM, Mark Schonewille wrote:

 Andre,
 
 on mouseUp
 put 0,1 into mySequence
 put 0 into mySum
 repeat
  put the last item of mySequence into myCurrentNumber
  if myCurrentNumber  4E6 then
   if myCurrentNumber mod 2 is 0 then add myCurrentNumber to mySum
   put myCurrentNumber  comma  (item 1 of mySequence + 
 myCurrentNumber) into mySequence
  else exit repeat
 end repeat
 put mySum
 end mouseUp
 
 --
 Best regards,
 
 Mark Schonewille

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-23 Thread Brian Yennie
Oooh, oooh!

In all seriousness, it would be fun if someone compiled a set of different 
correct solutions to these problems. What an incredible way of showing people's 
different coding styles in Rev.
(my solution to #2 after the break)

























put 0 into tot
put 1 into pre
put 2 into fib
repeat
   if (fib = 400) then exit repeat
   if (fib mod 2 = 0) then add fib to tot
   put fib into tmp
   add pre to fib
   put tmp into pre
end repeat___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-23 Thread Andre Garzia
Ho Ho Ho,

I am building a little stack with the solutions as buttons. There are
problems 1, 2, 6 (with comments showing it was from Mark), I am working on 5
now...

:D

will post it to RevOnLine

:D


On Tue, Feb 23, 2010 at 2:05 PM, Bob Sneidar b...@twft.com wrote:

 I was just about to say the same thing! ;-) Mark, you should post your
 solution, and quick! Otherwise Andre is going to do it! (j/k)

 Bob


 On Feb 23, 2010, at 8:49 AM, Mark Schonewille wrote:

  Andre,
 
  on mouseUp
  put 0,1 into mySequence
  put 0 into mySum
  repeat
   put the last item of mySequence into myCurrentNumber
   if myCurrentNumber  4E6 then
if myCurrentNumber mod 2 is 0 then add myCurrentNumber to
 mySum
put myCurrentNumber  comma  (item 1 of mySequence +
 myCurrentNumber) into mySequence
   else exit repeat
  end repeat
  put mySum
  end mouseUp
 
  --
  Best regards,
 
  Mark Schonewille

 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution




-- 
http://www.andregarzia.com All We Do Is Code.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-23 Thread Andre Garzia
Brian,

this is quite a good idea...

I think we could do a RevLet, this way we could post  execute the stuff.

:D

Let me cook something.

:D

On Tue, Feb 23, 2010 at 2:09 PM, Brian Yennie bri...@qldlearning.comwrote:

 Oooh, oooh!

 In all seriousness, it would be fun if someone compiled a set of different
 correct solutions to these problems. What an incredible way of showing
 people's different coding styles in Rev.
 (my solution to #2 after the break)

























 put 0 into tot
 put 1 into pre
 put 2 into fib
 repeat
   if (fib = 400) then exit repeat
   if (fib mod 2 = 0) then add fib to tot
   put fib into tmp
   add pre to fib
   put tmp into pre
 end repeat___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution




-- 
http://www.andregarzia.com All We Do Is Code.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-23 Thread Andre Garzia
Done!

checkout

http://wecode.org/euler

you need RevWeb plugin for that.

Cheers
andre
PS: check the source code to see some uberpretty revlet loading techniques!

On Tue, Feb 23, 2010 at 2:12 PM, Andre Garzia an...@andregarzia.com wrote:

 Brian,

 this is quite a good idea...

 I think we could do a RevLet, this way we could post  execute the stuff.

 :D

 Let me cook something.

 :D


 On Tue, Feb 23, 2010 at 2:09 PM, Brian Yennie bri...@qldlearning.comwrote:

 Oooh, oooh!

 In all seriousness, it would be fun if someone compiled a set of different
 correct solutions to these problems. What an incredible way of showing
 people's different coding styles in Rev.
 (my solution to #2 after the break)

























 put 0 into tot
 put 1 into pre
 put 2 into fib
 repeat
   if (fib = 400) then exit repeat
   if (fib mod 2 = 0) then add fib to tot
   put fib into tmp
   add pre to fib
   put tmp into pre
 end repeat___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution




 --
 http://www.andregarzia.com All We Do Is Code.




-- 
http://www.andregarzia.com All We Do Is Code.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Project Euler

2010-02-23 Thread Robert Brenstein

On 23.02.10 at 15:54 -0300 Andre Garzia apparently wrote:

Done!

checkout

http://wecode.org/euler

you need RevWeb plugin for that.

Cheers
andre
PS: check the source code to see some uberpretty revlet loading techniques!




revlet loading techniques? All I get is plugin not loaded.

Robert
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution