1. calc_primes gives one more result than the max

? calc_primes(10, 5)

{2,3,5,7,11} 

The max prime number should be 7 not 11. I had the same type of problem using 1000 (max_p). Euphoria Interpreter 4.0.0 Beta 4 (r3376) for Linux

new topic     » topic index » view message » categorize

2. Re: calc_primes gives one more result than the max

Anthill said...

? calc_primes(10, 5)

{2,3,5,7,11} 

The max prime number should be 7 not 11. I had the same type of problem using 1000 (max_p). Euphoria Interpreter 4.0.0 Beta 4 (r3376) for Linux

According to the manual (search 'calc_primes') this is working as expected.

max_p : an integer, the last prime returned is the next prime after or on this value. 

new topic     » goto parent     » topic index » view message » categorize

3. Re: calc_primes gives one more result than the max

Anthill said...

? calc_primes(10, 5)

{2,3,5,7,11} 

The max prime number should be 7 not 11. I had the same type of problem using 1000 (max_p). Euphoria Interpreter 4.0.0 Beta 4 (r3376) for Linux

from the docs, max_p : an integer, the last prime returned is the next prime after or on this value.

have a more descriptive parameter name?

new topic     » goto parent     » topic index » view message » categorize

4. Re: calc_primes gives one more result than the max

ne1uno said...

have a more descriptive parameter name?

Yeah the documentation should be a bit clearer. I'll attend to this.

new topic     » goto parent     » topic index » view message » categorize

5. Re: calc_primes gives one more result than the max

Ok maybe I should add this as a separate issue but this relates to primes as well:

? next_prime(997) outputs 997 but should be 1009.

The documentation (10.2.1.2 next_prime) says 1003 is the next prime but calc_primes disagrees and says 1009 is next.

prime_list(top_prime_p) has the same problem as calc_primes.

new topic     » goto parent     » topic index » view message » categorize

6. Re: calc_primes gives one more result than the max

Anthill said...

? next_prime(997) outputs 997 but should be 1009.

The documentation (10.2.1.2 next_prime) says 1003 is the next prime but calc_primes disagrees and says 1009 is next.

prime_list(top_prime_p) has the same problem as calc_primes.

good catch, Derek updated the docs and will be in the next update.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu