Skip to content

Commit 00f5048

Browse files
committed
[euler/prob009] use naive expression for upper bound
1 parent 1e2d228 commit 00f5048

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

euler/prob009-gerdr.pl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,9 @@
1616
#
1717
# a < (1 - 1/√2)·N
1818
#
19-
# which we use in the form
20-
#
21-
# a < (2·N - √(2·N²)) / 2
22-
#
23-
# to minimize computational errors.
2419

2520
sub triples(\N) {
26-
my \A = Int(2 * N - sqrt(2 * N * N)) div 2;
27-
28-
for 1..A -> \a {
21+
for 1..Int((1 - sqrt(0.5)) * N) -> \a {
2922
my \u = N * (N - 2 * a);
3023
my \v = 2 * (N - a);
3124

0 commit comments

Comments
 (0)