www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@cset_haltonset/private/getPrimeLeap.m

    function L = getPrimeLeap(DoLeap, NFact)
%GETPRIMELEAP Generate the current leap value
%
%  GETPRIMELEAP(DOLEAP, NF) returns the leap value that should be used
%  given a logical flag and the number of factors in the candidate set.

%  Copyright 2007 The MathWorks, Inc.

N = NFact+1;

if DoLeap
    % Find N-th prime number
    k = 4;
    P = [];
    while length(P)<N
        P = primes(k*N);
        k = k*2;
    end
    L = P(N)-1;
else
    L = 0;
end