If you want your own approach to work for larger numbers, use bigint.
In reply to Re: Prime Numbers by moritz in thread Prime Numbers by gtozoom