Computer Science Canada Prime Number Finder |
| Author: | doc [ Sun Jan 28, 2007 3:10 pm ] | ||
| Post subject: | Prime Number Finder | ||
My first Program Final Program in Turing I got a lame final project at school for computer science so i did it user friendly. Dam it my friend got a diferent one witch was a game. Any way it asked me to make a prog that finds the prime numbers. Instead of using just code that he teached the class i added user interface for drag and click people. :D I attached the compiled program and the code with no quotes to the post. Here is code with quotes that explain most stuff:
|
|||
| Author: | Bored [ Sun Jan 28, 2007 4:17 pm ] |
| Post subject: | Re: Prime Number Finder |
Yes your program works, yes it used GUI, but the point of the task was to create a program for finding prime number, which means the best program is the most efficient. Your program could do this task a lot quicker if you used a little brain power. First off, rather then going anc checking everynumber from 2 to itself, you only need to ceck every number from 2 to itself div 2. That is it can't be evenly divided by numbers more then half of itself. Secondly, the way you have gone about it is the slowest possible way. The more efficient way would be to cycle through all the number from 2 to your max div 2, then for each number flag all it's multiples as not prime. This can be done by using for and by. Now if a numbers been flaged as not prime you can skip it as all of it's multiple have then been flagged. This reduces the time taken hugely especially with larger numbers. Try immplementing this and resubmitting. |
|
| Author: | Skynet [ Sun Jan 28, 2007 5:15 pm ] |
| Post subject: | Re: Prime Number Finder |
Bored @ Sun Jan 28, 2007 4:17 pm wrote: Yes your program works, yes it used GUI, but the point of the task was to create a program for finding prime number, which means the best program is the most efficient. Your program could do this task a lot quicker if you used a little brain power. First off, rather then going anc checking everynumber from 2 to itself, you only need to ceck every number from 2 to itself div 2. That is it can't be evenly divided by numbers more then half of itself. Secondly, the way you have gone about it is the slowest possible way. The more efficient way would be to cycle through all the number from 2 to your max div 2, then for each number flag all it's multiples as not prime. This can be done by using for and by. Now if a numbers been flaged as not prime you can skip it as all of it's multiple have then been flagged. This reduces the time taken hugely especially with larger numbers. Try immplementing this and resubmitting.
Correct advice or not...that's an abrupt way of wording what should be "constructive criticism." |
|
| Author: | BenLi [ Mon Jan 29, 2007 2:37 pm ] |
| Post subject: | RE:Prime Number Finder |
actually, the way it was said was very kind. You have to know that people are here with good intentions. He did not bash your program, he simply made suggestions |
|
| Author: | Bored [ Mon Jan 29, 2007 6:07 pm ] |
| Post subject: | RE:Prime Number Finder |
That's one of the major disadvantages of the internet, the lack of general tone, and it's lead a many a times to misinterpretation. It's sometimes very hard to tell wether someones being sincere, and ass, sarcastic, or whatever by text alone, as generally 55% of comunication is body language (more for french people lol), 38% tone, and only 7% the actual words we use. Basically the internet tends to remove context leaving only the facts, and facts without context are rairly helpfull. In this case the facts being words (though things I say may not always be fact, it's fact that I say them), and the context being tone and body language. So what I'm trying to say is that was meant to be sincere and helpfull, not condesending and insulting. Try to imagine my voice as calm, and rather encouraging, as usually on this site and generally in real life that's what I try to be. |
|
| Author: | BenLi [ Mon Jan 29, 2007 11:26 pm ] |
| Post subject: | Re: Prime Number Finder |
Quote: Try to imagine my voice as calm, and rather encouraging, as usually on this site and generally in real life that's what I try to be.
Infact, that goes for most other people on this site as well |
|
| Author: | Cervantes [ Tue Jan 30, 2007 12:28 am ] |
| Post subject: | RE:Prime Number Finder |
Except for me. My voice is rough and satanic sounding. You know, the kind of voice that can stir ghouls from their resting places. The internet does wonders for my ability to talk to people without them turning heel and bolting. Look, there's an example of sarcasm! If you got that, you've proven that my intentions can make it past the maze that is the internet. |
|
| Author: | Clayton [ Tue Jan 30, 2007 1:01 pm ] |
| Post subject: | Re: Prime Number Finder |
Offtopic: And yet that has nothing to do with you suggesting you can stir ghouls from the dead? Generally yes, consider people here willing to help and not trying to condescend you, rather trying to give you constructive criticism. |
|
| Author: | Skynet [ Tue Jan 30, 2007 2:45 pm ] |
| Post subject: | Re: Prime Number Finder |
One note: I was not offended, as it wasn't my topic, nor my program. |
|