changing check from < sn to <=sn to fix problem with 9009.
Since sn is an integer that may be less than sqrt(n) we have
to check up to sn.