Lecture 2

Nov. 11th, 2009 05:21 pm
elz: (ada-tubes)
[personal profile] elz posting in [community profile] intro_to_cs






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)

Date: 2009-11-12 12:13 am (UTC)
From: [personal profile] ex_wicker969
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?

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

Date: 2009-11-12 05:55 am (UTC)
From: [personal profile] ex_wicker969
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

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

MoDeXpCzNyFKFCSvSS

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

vqiwThxRBr

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

Profile

Introduction to Computer Science

July 2010

S M T W T F S
    123
45678910
11121314151617
18192021222324
2526272829 3031

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 17th, 2025 09:05 am
Powered by Dreamwidth Studios