1. calc_primes gives one more result than the max
- Posted by Anthill Nov 08, 2010
- 1137 views
? 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
2. Re: calc_primes gives one more result than the max
- Posted by DerekParnell (admin) Nov 08, 2010
- 1110 views
? 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.
3. Re: calc_primes gives one more result than the max
- Posted by ne1uno Nov 08, 2010
- 1088 views
? 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?
4. Re: calc_primes gives one more result than the max
- Posted by DerekParnell (admin) Nov 08, 2010
- 1090 views
have a more descriptive parameter name?
Yeah the documentation should be a bit clearer. I'll attend to this.
5. Re: calc_primes gives one more result than the max
- Posted by Anthill Nov 08, 2010
- 1103 views
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.
6. Re: calc_primes gives one more result than the max
- Posted by ne1uno Nov 08, 2010
- 1056 views
? 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.