The largest prime that needs to be checked for factors of a number n is floor(sqrt(n)), or |sqrt(n)| in some notations, meaning the largest integer that does not exceed sqrt(n).
For example, if checking 169, whose squre-root is 13. There will be NO prime factors below 13 (1 is not a prime). So check for all prime factors up to and including the largest prime equal to or less than sqrt(n).