Thats ok. Though personally I would still put the sqrt() call inside the Prime() function, but place it before the start of the for loop.
I messed around with the code here quite a lot, in order to avoid checking all the even numbers too. It looks a bit of a mess, I don't know whether it can be simplified further.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
bool Prime (unsignedlong st)
{
if (st<2)
returnfalse;
if (st == 2)
returntrue;
if (st%2 == 0)
returnfalse;
unsignedlong limit = sqrt(double(st));
for (unsignedlong i = 3; i <= limit; i+=2)
if (st % i == 0)
returnfalse;
returntrue;
}