Steven D'Aprano wrote:
On Mon, 30 Aug 2010 05:31:00 am bob gailer wrote:
My current reasoning was something of this sort: Find all the
factors of a number, then reduce them to just the prime factors
Very inefficient. IMHO the proper way is to generate a list of all
the prime numbers
"Nick" wrote
I didn't call the functions in the program because I was
calling them myself in the interpreter after running it.
I assume you mean after importing it?
Running a program is generally taken to mean executing the script as
a standalone program. To execute the internal functions
On Mon, 30 Aug 2010 05:31:00 am bob gailer wrote:
> > My current reasoning was something of this sort: Find all the
> > factors of a number, then reduce them to just the prime factors
>
> Very inefficient. IMHO the proper way is to generate a list of all
> the prime numbers up to the square root
"Did you test the program? That is one way to tell whether it works perfectly.
What you showed above will do one visible thing - it will print "Don't forget
to consider primes 2, 3, 5, and 7\n". The rest is a somewhat confusing
collection of function definitions and comments. You never call the
On 8/29/2010 3:08 AM, Nick wrote:
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
#don't forget 2,3,5,7. this function doesn't deliver those as output.
def is_prime(b): #checks a number greater than 7 to see if it is
prime and
"Nick" wrote
What is the largest prime factor of the number 600851475143 ?
For help on the math aspects try Wikipedia.
Look up Prime factors...
Would it be useful for me to buy a book, and if so what are some
easily accessible ones? I feel dive into python is just too
advanced for me.
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
#don't forget 2,3,5,7. this function doesn't deliver those as output.
def is_prime(b): #checks a number greater than 7 to see if it is prime and
returns if is.
if b % 2 != 0 and b