Anonymous user
N-smooth numbers: Difference between revisions
→{{header|Ruby}}
Line 2,628:
def nsmooth(n, limit)
raise "Exception(n or limit)" if n < 2 || n > 521 || limit < 1
raise "Exception(must be a prime number: n)"
primes = gen_primes(2, n)
ns = [0] * limit
ns[0] = 1
nextp = primes[0..primes.index(n)]
indices = [0] * nextp.size
|