Is 2,904,897 A Prime Number?
This little trick may win a bar bet someday and it's inexplicable on the surface, so is cool just for that. Well, it's not EVEN, so isn't a multiple of 2, doesn't end in 5, so isn't divisible by 5, but that leaves a lot of ground.
In case you forgot, you only have to divide a prime "candidate" by every interger up to the square root of the number; if you've not found a factor by then there won't BE any. But that's a lot of work if you don't get lucky. Here's the "trick": Add the digits of the candidate [2+9+0+4+8+9+7 = 39]. If the sum is divisible by 3, then so is the candidate.Sure, if you ACTUALLY divided by 3 you'd discover it's not prime, but what if the candidate isn't so small. It's a lot of dividing. Keep adding the "sum" numbers when the numbers are big, like 39932133621 as a sum for a large candidate, paring it down to size [3+9+9+3+2+1+3+3+6+2+1 = 42] then [4+2 = 6] until it's managable.
freeed 61-65, M 10 Responses 4 May 26, 2010