#!/bin/python import sys import math MAX=10**5+1 pr=[1]*MAX pr[1]=0 for i in xrange(2,int(math.sqrt(MAX))+1): if pr[i]: k=2 while i*k