Re: Any Better logic for this problem..

2011-06-10 Thread geremy condra
On Thu, Jun 9, 2011 at 6:10 PM, Dan Stromberg wrote: > > On Thu, Jun 9, 2011 at 10:55 AM, geremy condra wrote: >> >> On Thu, Jun 9, 2011 at 4:38 AM, Dave Angel wrote: >> > On 01/-10/-28163 02:59 PM, Chris Rebert wrote: >> >> >> >> On Thu, Jun 9, 2011 at 1:31 AM, Ganapathy Subramanium >> >>  wro

Re: Any Better logic for this problem..

2011-06-09 Thread Dan Stromberg
On Thu, Jun 9, 2011 at 10:55 AM, geremy condra wrote: > On Thu, Jun 9, 2011 at 4:38 AM, Dave Angel wrote: > > On 01/-10/-28163 02:59 PM, Chris Rebert wrote: > >> > >> On Thu, Jun 9, 2011 at 1:31 AM, Ganapathy Subramanium > >> wrote: > >>> > >>> Hi Guru's, > >>> I'm working on a solution to fin

Re: Any Better logic for this problem..

2011-06-09 Thread Chris Angelico
On Fri, Jun 10, 2011 at 8:39 AM, Gregory Ewing wrote: > Chris Angelico wrote: > >> Rather than find all prime numbers up to num, stop at sqrt(num) - it's >> not possible to have any prime factors larger than that. > > That's not quite true -- the prime factors of 26 are 2 and 13, > and 13 is clear

Re: Any Better logic for this problem..

2011-06-09 Thread Gregory Ewing
Chris Angelico wrote: Rather than find all prime numbers up to num, stop at sqrt(num) - it's not possible to have any prime factors larger than that. That's not quite true -- the prime factors of 26 are 2 and 13, and 13 is clearly greater than sqrt(26). However, once you've divided out all th

Re: Any Better logic for this problem..

2011-06-09 Thread geremy condra
On Thu, Jun 9, 2011 at 4:38 AM, Dave Angel wrote: > On 01/-10/-28163 02:59 PM, Chris Rebert wrote: >> >> On Thu, Jun 9, 2011 at 1:31 AM, Ganapathy Subramanium >>  wrote: >>> >>> Hi Guru's, >>> I'm working on a solution to find the prime factor of the number >>> This part of the code works.. http:

Re: Any Better logic for this problem..

2011-06-09 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Chris Rebert wrote: On Thu, Jun 9, 2011 at 1:31 AM, Ganapathy Subramanium wrote: Hi Guru's, I'm working on a solution to find the prime factor of the number This part of the code works.. http://www.pastie.org/2041584 For the archives, that code is: num =3195 #num

Re: Any Better logic for this problem..

2011-06-09 Thread Chris Angelico
On Thu, Jun 9, 2011 at 7:06 PM, Chris Rebert wrote: > On Thu, Jun 9, 2011 at 1:31 AM, Ganapathy Subramanium > wrote: >> Hi Guru's, >> I'm working on a solution to find the prime factor of the number >> This part of the code works.. http://www.pastie.org/2041584 > > For the archives, that code is:

Re: Any Better logic for this problem..

2011-06-09 Thread Ian
On 09/06/2011 09:31, Ganapathy Subramanium wrote: Hi Guru's, I'm working on a solution to find the prime factor of the number This part of the code works.. http://www.pastie.org/2041584 When the number gets bigger, the range cannot iterate through bigger number and it does not work. When I g

Re: Any Better logic for this problem..

2011-06-09 Thread Chris Rebert
On Thu, Jun 9, 2011 at 1:31 AM, Ganapathy Subramanium wrote: > Hi Guru's, > I'm working on a solution to find the prime factor of the number > This part of the code works.. http://www.pastie.org/2041584 For the archives, that code is: num = 13195 #num = 600851475143L prime_numbers = [2] prime_fa