  n = 500000;

%function total = prime_number ( n )

%% PRIME_NUMBER returns the number of primes between 1 and N.

  total = 0;

  parfor i = 2 : n

    prime = 1;

    parfor j = 2 : i
      if ( mod ( i, j ) == 0 )
        prime = 0;
      end
    end

    total = total + prime;

  end

%end
