function total = prime_number_parallel ( n )

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

  total = 0;

  parfor i = 2 : n

    prime = 1;

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

    total = total + prime;

  end

  return
end
