Wednesday, August 31, 2011

Primes

In mathematics, natural numbers are prime numbers greater than 1, the denominator factor is 1 and the number itself. 2 and 3 is prime. 4 is not prime because 4 can be divided by 2. The first ten prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29.

If a number is greater than one is not prime, then the numbers are called composite numbers. The simplest way to determine the primes smaller than a certain number is to use the sieve of Eratosthenes

Beri peringkat terjemahan

Biggest Prima Numbers
 
Mathematically, there is no "the largest prime number", because the number of primes is infinite. [1] the largest known prime number as of August 2007 is 232582657-1. [2] This number has 9,808,358 digits [1 ] and is a Mersenne prime number is the 44th. M32582657 (thus writing notations Mersenne primes the 44th) was discovered by Curtis Cooper and Steven Boone on September 4, 2006 which are professors from the University of Central Missouri in cooperation with tens of thousands of other members of the GIMPS project.(....)



prime examples of program code:

#pragma argsused
#include <iostream.h>

   class prima{
     friend istream& operator >> (istream&, prima&);
   public:
     void count();
   private:
     int prima,x,i,result;
   };
     istream& operator >> (istream& in, prima& input){
    cout<<"enter numbers :";
    in>>input.prima;
    return in;
    }
    void prima::count(){
    for (int i=1; i<prima; i++){
    if((prima%prima==0)||(prima % 1==0)){
    //result = prima % i;
    cout<<prima<<"mod"<<i<<"="<<"primes\n";
    }
    else {
    cout<<prima<<" "<<"not a prime number";
    }}}

    int main(){

    int a;

    prima x;
    cin>>x;
    x.count();
    cin>>a;

    return 0;
}
 

good luck...!!!






source : http://id.wikipedia.org/wiki/Bilangan_prima


0 comments:

Template by : wanto arwan-programing.blogspot.com