elz (
elz) wrote in
intro_to_cs2009-11-11 10:52 pm
Entry tags:
Poll & solutions
First:
Also, it occurs to me that it might be handy to have a place to post/discuss solutions to the problem sets, to see what we can learn from each other in the absence of TAs. If you actually go to MIT and the problem sets are still the same, don't read these. ;)
Fire away!
Open to: Registered Users, detailed results viewable to: All, participants: 25
Tickyboxes!
Also, it occurs to me that it might be handy to have a place to post/discuss solutions to the problem sets, to see what we can learn from each other in the absence of TAs. If you actually go to MIT and the problem sets are still the same, don't read these. ;)
Fire away!
no subject
Problem 1
import math primes = [2] x = 3 while len(primes) < 1000: divisible = False root = math.sqrt(x) for y in primes: if x % y == 0: divisible = True break if y > root: break if not divisible: print x primes.append(x) x += 2no subject
no subject
no subject
no subject
import math n = int(raw_input('n? ')) primes = [2] x = 3 logs = 0 while x <= n: divisible = False root = math.sqrt(x) for y in primes: if x % y == 0: divisible = True break if y > root: break if not divisible: logs += math.log(x) primes.append(x) x += 2 print logs print logs / nno subject
WzOvEpgUHNwG
(Anonymous) 2012-05-03 02:40 pm (UTC)(link)