from visual import *


k=0
limit = 200

As=list()           # list of natural numbers
Bs=list()           # list of primes
Cs=list()           # list of product numbers

As.append(1)
As.append(2)

Bs.append(1)
Bs.append(2)

Cs.append(1)
Cs.append(2)

def intersection(list1,list2):
    outlist = list()
    for x in xrange(len(list2)):
        if list1.count(list2[x]) == 0:
            pass
        else:
            if outlist.count(list2[x]) == 0:
                outlist.append(list2[x])
            else:
                pass
    return outlist

def subtraction(list1,list2):               ## list 2 from list 1
    outlist = list()
    for x in xrange(len(list1)):
        outlist.append(list1[x])
    for x in xrange(len(list2)):
        if outlist.count(list2[x]) == 0:
            pass
        else:
            outlist.pop(outlist.index(list2[x]))
    return outlist

def copylist(list1):
    outlist = list()
    for x in xrange(len(list1)):
        outlist.append(list1[x])
    return outlist

k = 1
while limit-2 > k:
    k += 1
    
    for x in xrange(len(Bs)):
        for y in xrange(len(Bs)):
            if Bs[x] != 1 and Bs[y] != 1:
                b = Bs[x]*Bs[y]

                if b > limit:
                    pass
                else:            
                    if Bs.count(b) == 0:
                        Bs.append(b)

    r = subtraction(subtraction(Bs,intersection(Bs,Bs)),Bs)
    r.sort()

    if len(r)==0:
        pass
    else:
        if Bs.count(r[0])==0:
            Bs.append(r[0])
            print(r[0])
    if As.count(k+1) == 0:
        As.append(k+1)
        
    As.sort()
    Cs.sort()            
    Bs.sort()
    
##    print("list of natural numbers:",As)
##    print("list of products:",Cs)
##    print("Subtraction of intersection of products and natural numbers from naturals",r)
##    print("list of primes:",Bs)

print(As)
print(Bs)
print(Cs)
