elz: (ada-tubes)
elz ([personal profile] elz) wrote in [community profile] intro_to_cs2009-11-11 05:21 pm
Entry tags:

Lecture 2







Problem set 1: Computing prime numbers, product of primes

This one's a little trickier, so feel free to comment if you run into any problems or want to brainstorm with other people!

(eta: having issues with poll, alas)

[personal profile] ex_wicker969 2009-11-12 12:13 am (UTC)(link)
Man it is times like these when I know how non-mathy my brain is. I got all the primes between 1 and 1000 but my code is ungainly and ugly and I kind of just printed 2, 3, 5, and 7 before I got the ball rolling on the rest by nesting 'if' and n%2!=0, n%3!=0 ... etc.

Anybody else make a pretty ugly program? I'm gonna go try it again at some point tonight. How'd your approach differ from mine?
ungemmed: (Default)

[personal profile] ungemmed 2009-11-12 01:30 am (UTC)(link)
hint: You may want to put the primes in a list as you find them.

[personal profile] ex_wicker969 2009-11-12 05:55 am (UTC)(link)
Thank you! I'm giving it another shot and I think I'm starting to get the hang of it.

(I realized I totally got off-track and tried to get an answer the problem didn't ask for.)

pXWMiprUPTOVcxLS

(Anonymous) 2012-01-07 09:28 am (UTC)(link)
Weeeee, what a quick and easy souliton.

MoDeXpCzNyFKFCSvSS

(Anonymous) 2011-08-14 05:14 am (UTC)(link)
You're the gretaset! JMHO

vqiwThxRBr

(Anonymous) 2012-01-09 05:19 am (UTC)(link)
If my problem was a Death Star, this atircle is a photon torpedo.