L=range(2,input()+1)while L[0]*2<=L[-1]:L.remove(L[0]*2);L=L[1:]print L
22
[12, 13, 15, 17, 19, 20, 21]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!