|
Page 1 of 1
|
[ 4 posts ] |
|
Prime Factorization of Positive Integers
Author |
Message |
Coder A
Moderator
Joined: Thu Jan 03, 2013 5:10 pm Posts: 207 Location: The plateau north of the Ohio River Valley, also known as Cave Country.
|
 Prime Factorization of Positive Integers
This is my code for factorizing a number input to the function and some code put around it. The function simply returns the smallest factor greater than one of its input (which is prime for any input other than 1 or 0), and the code repeatedly calls this function to determine the entire factorization of the number. My only problem is I don't know what I should use the function for other than math. Feel free to use it and tell me how you did so we can learn together. I don't even know if factand is a word! -Coder A
_________________ I'm not a robot! I'm british! ~ quote from an asparagus I am not a robot! I am a unicorn! ~ quote from a robot
|
Mon Feb 11, 2013 5:41 pm |
|
 |
ernest314
Rookie
Joined: Sun Nov 11, 2012 6:21 pm Posts: 5
|
 Re: Prime Factorization of Positive Integers
Recursive solutions are cool, but not the most efficient (if you deal with large numbers, you might run out of resources). Have you taken a look at Eratosthenes' sieve? It's pretty handy 
|
Sat Jun 01, 2013 11:30 pm |
|
 |
Coder A
Moderator
Joined: Thu Jan 03, 2013 5:10 pm Posts: 207 Location: The plateau north of the Ohio River Valley, also known as Cave Country.
|
 Re: Prime Factorization of Positive Integers
Actually, I am using an iterative approach. And Eratosthenes' sieve is neat, but not good for determining if just a single number is false, because you must determine all the primes lesser than the input number as well, which leads to memory issues, much in the same way a recursive algorithm would. But thanks for the comment!
_________________ I'm not a robot! I'm british! ~ quote from an asparagus I am not a robot! I am a unicorn! ~ quote from a robot
|
Thu Aug 22, 2013 6:15 pm |
|
 |
Ernest3.14
Professor
Joined: Sat May 18, 2013 1:24 pm Posts: 271 Location: Olympia, WA
|
 Re: Prime Factorization of Positive Integers
_________________FTC Team 6424, the 'Oly Cow - Chief programmer. FRC Team 4450, Olympia Robotics Federation (ORF). and also quadrotors. Quadrotors!
|
Fri Aug 23, 2013 12:48 pm |
|
|
|
Page 1 of 1
|
[ 4 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|