#This finds all primes up to a limit and prints them in a table
# with 7 columns

def main():
    limit = input ("Enter the largest number to test " )
    lineCount = 0
    num = 2
    while num <= limit:
        factor = 2
        while factor < num:
            if num % factor == 0:
                isPrime = False
                break
            factor = factor + 1
        else:
            isPrime = True

        if isPrime:
            print "%10d" % num,
            lineCount = lineCount + 1
            if lineCount == 7:
                print
                lineCount = 0
        num = num + 1
    
main()
        
