Sunday, July 8, 2012
Project Euler Problem 10
I realised something while waiting for my program to finish counting. I have went downstair and watched an episode of some TV program on TV. Then I got back upstair, just to see it is not finished yet.
=| "Owh, still counting..."
=O "What the heaven?"
=| "Still didn't reach 1 million..."
That's about half hour. Thinking a little bit about my program. Hmm.... The computer science book beside me reminded me about software engineering. That focus on how to make more efficient codes and use less memory. So, I guess my program is not efficient.
This is where my imagination power comes in. Simulate and guessing the result in my head, I see that my prime function will calculate too much for large number. So, I cut in between the for loop, breaking it as soon as it is confirmed not a prime (that is, if it can be divided to more than 2 digits-1 and itself-it is false). my codes may be able to become more efficient, but that's just about what I can manage. What do you expect from an inexperience beginner programmer that's too lazy to practice? :P
=0 "OMG so much faster! Awesome!"
1179908154
"It is incorrect."
=x "Imma ouuta here."
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment