about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-13 23:27:46 +0000
committerbors <bors@rust-lang.org>2014-10-13 23:27:46 +0000
commit1c3ddd297128a96f72be09bddf138e4e603a7aa1 (patch)
tree8ad80b85668ed8a8ef656d41b2350f95c49189b6 /src
parent36d0346dff9eae54e81f3a5a8417bc1b9c897e78 (diff)
parent7cf1f55426570582224e0568c838a29c5f7db5ea (diff)
downloadrust-1c3ddd297128a96f72be09bddf138e4e603a7aa1.tar.gz
rust-1c3ddd297128a96f72be09bddf138e4e603a7aa1.zip
auto merge of #17888 : gmfawcett/rust/patch-1, r=alexcrichton
The Sieve algorithm only requires checking all elements up to and including the square root of the maximum prime you're looking for. After that, the remaining elements are guaranteed to be prime.
Diffstat (limited to 'src')
-rw-r--r--src/libcollections/bitv.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs
index 8f9873d77d1..fa9ed335f1f 100644
--- a/src/libcollections/bitv.rs
+++ b/src/libcollections/bitv.rs
@@ -33,7 +33,7 @@
 //!     bv.set(0, false);
 //!     bv.set(1, false);
 //!
-//!     for i in range(2, max_prime) {
+//!     for i in iter::range_inclusive(2, (max_prime as f64).sqrt() as uint) {
 //!         // if i is a prime
 //!         if bv[i] {
 //!             // Mark all multiples of i as non-prime (any multiples below i * i