bcroq


Joined 1 year ago
Homeworks submitted:
Homework comments:
2
0

About Me

No description provided.

Classes

MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming

Class status: Established
Role: Student
. 11% complete

Submitted Assignments

MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming: Lesson 2, HW 1
# Problem Set 1
# Name: Bertrand Croq
# Time: 00:10

from math import log


def problem1(count=1000):
    primes = []
    n = 1
    print 1 # 1 is prime

    while len(primes) < count:
        n += 1
        for p in primes:
            if not (n % p):
                break
        else:
            print n
            primes.append(n)


def problem2(n):
    primes = []
    sum = 0

    def show():
        print sum, current, sum / current

    for current in xrange(2, n+1):
        for p in primes:
            if not (current % p):
                break
        else:
            sum += log(current)
            primes.append(current)
            #show()
    show()

bcroq 1 year ago
MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming: Lesson 1, HW 1
# Problem Set 0
# Name: Bertrand Croq
# Time: 0:05

name = raw_input('Enter your last name:\n**')
firstname = raw_input('Enter your first name:\n**')
print firstname
print name

bcroq 1 year ago