aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-158/cheok-yin-fung/dart/ch-2.dart5
1 files changed, 2 insertions, 3 deletions
diff --git a/challenge-158/cheok-yin-fung/dart/ch-2.dart b/challenge-158/cheok-yin-fung/dart/ch-2.dart
index 265cae1291..7d425e4584 100644
--- a/challenge-158/cheok-yin-fung/dart/ch-2.dart
+++ b/challenge-158/cheok-yin-fung/dart/ch-2.dart
@@ -17,10 +17,9 @@ void main(List<String> args) {
spokes.add( rp_to_30[i] ); // skip 1
while (pp <= arg) {
if (pp % 5 == 0) continue; // pp must be coprime to 2 and 3.
- if (spokes.last <= sqrt(pp)) {
+ if (spokes.last < sqrt(pp)) {
var k = ((spokes.last+1)/30).floor();
- for (; k*30 <= sqrt(pp); k++)
- rp_to_30.forEach( (e) => spokes.add(e+k*30) );
+ rp_to_30.forEach( (e) => spokes.add(e+k*30) );
}
y++;
if (spokes.any( (d) => pp % d == 0 )) {