From e2dc8c813b1abcf9b9c1aa2518602af9050738f3 Mon Sep 17 00:00:00 2001 From: E7-87-83 Date: Wed, 30 Mar 2022 10:08:59 +0800 Subject: optimize --- challenge-158/cheok-yin-fung/dart/ch-2.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/challenge-158/cheok-yin-fung/dart/ch-2.dart b/challenge-158/cheok-yin-fung/dart/ch-2.dart index 08b2ad77b0..265cae1291 100644 --- a/challenge-158/cheok-yin-fung/dart/ch-2.dart +++ b/challenge-158/cheok-yin-fung/dart/ch-2.dart @@ -18,7 +18,8 @@ void main(List args) { while (pp <= arg) { if (pp % 5 == 0) continue; // pp must be coprime to 2 and 3. if (spokes.last <= sqrt(pp)) { - for (int k=1; k*30 <= sqrt(pp); k++) + var k = ((spokes.last+1)/30).floor(); + for (; k*30 <= sqrt(pp); k++) rp_to_30.forEach( (e) => spokes.add(e+k*30) ); } y++; -- cgit