Test If Number Is Prime Number

  • i'm looking to determine if a number is prime or not...

    i thought of testing with the mod function in an adjacent cell...but i'm not sure how to do...?


    thank you.

  • Re: Mod Function


    Is that formula meant to test if a number is prime?

    When I try it I get some strange results.

    eg 2,3 - not prime, 15, 21,25, 33 - prime

    Perhaps I didn't use the formula right, all I did was pop it in B1 and then enter various numbers in A1.


  • Re: Mod Function

    Google found this too:


    by Bob Umlas

    This array formula returns TRUE if the number in cell A1 is a prime number.


    Use it as a conditional formatting formula, with A1 as the active cell
    in the selection to be formatted.

    Here's how Bob's amazing formula works. In a nutshell, the number is
    divided by all potential prime factors, and the resulting array is tested
    to see whether it contains a whole number. If is does, you have a prime
    number. A limitation of this formula is that it cannot test numbers that
    are greater than 65535^2. This is due to the array size constraint in
    Excel 97/2000.


  • Re: Test If Number Is Prime

    Ah, should of thought of that.:oops:

    Was starting to think that the basic foundations of mathematics had seismically shifted overnight and my (ancient) maths degree was worthless.

    Oh, wait a minute that degree is practically worthless.:roll:

    Never got me a job anyway, and the most common comment is 'So you're a teacher then?'.:crying:

    :dolphin: :dolphin: :dolphin: :dolphin:


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!