Re: Prime numbers



Thanks for trying to help me guys. Ok, so I understand that there is no
even prime number, besides 2. And also if, you mod any even number by
2, the result will obviously be 0. But then, how do I deal with
composite (non prime) numbers, that are odd.

I have come up with the following algorithm so far:
If inputNum Mod 2 = 0 Then (for even non prime numbers)
' not prime
elsif inputNum mod ?? = ?? Then (for odd non prime numbers)
' not prime
else (for prime numbers)
' number is prime

can you guys please help me out a little more.



Thanks in advance.

.



Relevant Pages

  • Odds and evens, or just odds
    ... Does anyone know of an algorithm to check if a number is odd or even ... and perform a calculation to ensure that number becomes either odd or ... Prev by Date: ...
    (comp.compression)
  • Re: EFFICIENCY: PRIME TEST vs PRIME GENERATOR
    ... > Let's suppose we have an algorithm that will take a positive ... > For example, the USUAL test runs on odd numbers, checking for primality. ... > The time it takes to prove one such number is either composite or prime is ... > you DON'T use every partition, you might require very large exponents. ...
    (sci.math)
  • Re: 2*k+3 = p
    ... 2n+3 = composite and all not in this matrix is ... andKbelong to TdL ... Lets now show what the triangle matrix ... Leaving only the odd primes. ...
    (sci.math)
  • Re: Primes algorithm
    ... > method which is generally used, as far as I know, is the Miller-Rabin ... > algorithm, ... > that a given number is composite, then it is definitely composite; ... A number is prime with a probability equal to either 0 or to 1. ...
    (sci.crypt)
  • Re: Towards a Formula for Primes
    ... did the OP prove that this algorithm always makes primes? ... which are either composite, or not necessarily prime ... it certainly comports to Big Peak Oil's statistics -- ...
    (sci.math)