It looks like your algorithm almost works, except that you are off by one prime, because 3 is not listed as a prime. To see why 3 is left out, consider what happens when test_n = 2. First, it is printed, then test_n=3 and divisor=2. Now, test_n != divisor, so test_n=4 and divisior=2. On the next iteration, 3 has been skipped entirely.
This may be a more typical algorithm for trial division:
Code:if number is 2 number is prime else if number is divisible by 2 number is composite else calculate square root of number loop over the odd integers starting from 3 until the square root calculated if number is divisible by current odd integer number is composite (can end loop) if loop ends without finding a divisor number is prime