Click here to Skip to main content
       

Algorithms

 
GeneralRe: I know, PinmvpCPallini3-Jul-08 0:53 
AnswerRe: NORMSDIST function Pinmember73Zeppelin3-Jul-08 2:11 
QuestionRe: NORMSDIST function PinmvpCPallini3-Jul-08 2:29 
AnswerRe: NORMSDIST function Pinmember73Zeppelin3-Jul-08 3:19 
GeneralRe: NORMSDIST function Pinmembersumit70343-Jul-08 2:47 
GeneralRe: NORMSDIST function PinmemberMember 82494620-Dec-11 23:54 
GeneralThe six rightmost non-zero digits of 1000000! PinmemberRod Gowdy2-Jul-08 4:50 
GeneralRe: The six rightmost non-zero digits of 1000000! [modified] PinmemberRobert.C.Cartaino2-Jul-08 6:33 
GeneralRe: The six rightmost non-zero digits of 1000000! PinmemberRod Gowdy3-Jul-08 3:42 
GeneralRe: The six rightmost non-zero digits of 1000000! PinmemberRobert.C.Cartaino3-Jul-08 10:06 
QuestionSpecify numbers as product of Primes? PinmemberIan Uy25-Jun-08 19:37 
AnswerRe: Specify numbers as product of Primes? Pinmembercp987625-Jun-08 21:32 
GeneralRe: Specify numbers as product of Primes? PinmemberIan Uy26-Jun-08 0:42 
AnswerRe: Specify numbers as product of Primes? PinmemberRobert.C.Cartaino26-Jun-08 4:48 
Ian Uy wrote:
I'm lost on how to begin to tackle this problem. Please advice.

 
As a college student, you really should be able to do this. It's basic math.
 
What you will want to search for is called "prime factorization." The easiest-to-understand technique is called "trial division."
 
On paper, you start by writing down your large number (let's call it 'n'). Then try to think of another number which divides evenly into n without any remainder. That number is a factor of n. It's easiest to start with small numbers.
 
In your example, what number divides evenly into 120? How about 2? Yes, 120/2=60. So write down 2 and 60 (those are factors of 120, but not necessarily prime).
 
Then try to factor each number you wrote down (the 2 and the 60). Are there any numbers (other than 1) that divide into 2 evenly? No, so 2 is a "prime factor" of 120 (i.e. 2 cannot be divided any further).
 
How about the 60? 60/2=30. So, there is another 2 that is a prime factor of 120. So far we have the factors of 120=2,2,30. Now factor the 30 and keep going.
 
Keep going until you run out of numbers that can be divided evenly. Those will be your prime factors.
 
120 factored = 2,60 (2 is prime)
60 factored = 2,30 (2 is prime)
30 factored = 2,15 (2 is prime)
15 factored = 3,5 (both 3 and 5 are prime)
Done.
 
The prime factors of 120 are (from the parentheses above) 2,2,2,3,5.
 
Now try writing that in code and see what you come up with. You can use this Table of Prime Factors[^] to check your answers.
GeneralRe: Specify numbers as product of Primes? PinmemberIan Uy26-Jun-08 4:50 
GeneralRe: Specify numbers as product of Primes? PinmemberThe Developer8-Aug-08 7:03 
GeneralRe: Specify numbers as product of Primes? PinmemberIan Uy26-Jun-08 6:28 
GeneralRe: Specify numbers as product of Primes? PinmemberPaul Conrad28-Jun-08 5:44 
GeneralRe: Specify numbers as product of Primes? PinmemberIan Uy28-Jun-08 5:46 
GeneralRe: Specify numbers as product of Primes? PinmemberPaul Conrad28-Jun-08 6:11 
GeneralRe: Specify numbers as product of Primes? PinmemberRavi Bhavnani8-Aug-08 7:16 
GeneralRe: Specify numbers as product of Primes? Pinmembercp987628-Jun-08 20:27 
GeneralRe: Specify numbers as product of Primes? PinmvpLuc Pattyn29-Jun-08 2:42 
GeneralRe: Specify numbers as product of Primes? PinmemberMarkBrock27-Jun-08 18:46 
GeneralRe: Specify numbers as product of Primes? PinmemberPaul Conrad28-Jun-08 5:42 
GeneralRe: Specify numbers as product of Primes? PinmemberChandraRam2-Jul-08 22:49 
GeneralRe: Specify numbers as product of Primes? PinmemberMarkBrock2-Jul-08 23:06 
AnswerRe: Specify numbers as product of Primes? PinmemberMember 419459326-Jun-08 8:19 
GeneralRe: Specify numbers as product of Primes? PinmemberRobert.C.Cartaino26-Jun-08 8:47 
GeneralRe: Specify numbers as product of Primes? PinmemberIan Uy26-Jun-08 17:51 
GeneralRe: Specify numbers as product of Primes? Pinmembercp987629-Jun-08 14:57 
AnswerRe: Specify numbers as product of Primes? PinmemberArash Partow29-Jun-08 0:48 
GeneralRe: Specify numbers as product of Primes? [modified] Pinmembercp987629-Jun-08 3:53 
GeneralRe: Specify numbers as product of Primes? PinmvpLuc Pattyn29-Jun-08 4:40 
GeneralRe: Specify numbers as product of Primes? Pinmembercp987629-Jun-08 14:47 
GeneralRe: Specify numbers as product of Primes? PinmemberArash Partow30-Jun-08 2:54 
GeneralRe: Specify numbers as product of Primes? Pinmembercp987630-Jun-08 3:18 
GeneralRe: Specify numbers as product of Primes? PinmemberArash Partow30-Jun-08 4:27 
GeneralRe: Specify numbers as product of Primes? PinmemberArash Partow30-Jun-08 2:17 
Questionlogic of prob function in ms excel Pinmembersumit703425-Jun-08 0:40 
QuestionFactorials PinmemberIan Uy24-Jun-08 8:17 
AnswerRe: Factorials PinmemberTim Craig24-Jun-08 10:29 
GeneralRe: Factorials PinmemberIan Uy25-Jun-08 6:32 
GeneralRe: Factorials PinmemberTim Craig25-Jun-08 8:55 
GeneralRe: Factorials PinmvpLuc Pattyn25-Jun-08 11:01 
GeneralRe: Factorials PinmemberTim Craig25-Jun-08 21:06 
AnswerRe: Factorials Pinmembercp987624-Jun-08 12:33 
AnswerRe: Factorials PinmemberMatthew Butler24-Jun-08 12:38 
GeneralRe: Factorials Pinmembercp987624-Jun-08 14:05 
GeneralRe: Factorials PinmvpLuc Pattyn24-Jun-08 15:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | Last Updated 4 Aug 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid