The
Wikipedia article is helpful, I think.
Use some integer factorization algorithm to factor the number you want, getting each prime factor and the exponent it has in the prime factorization.
Store the prime factors in an sorted list [p1,p2,p3,...,pj] and exponent [a1,a2,a3,...,aj].
Set an integer sigma to 1.
If the first prime factor is not 2, the number is not practical.
Then for each prime factor:
Multiply sigma by (p_i^a_i-1)/(p_i-1)
if sigma+1 is greater than the next largest prime factor, your number is not practical.
Else, increment i and continue again.
If that holds for every prime factor, then your number is indeed practical.
That method, assuming a decent factorization algorithm is used, would work better than the method described in the previous post, I think.