Skip to content

Commit ea70e6e

Browse files
committed
[euler/prob029] replace loop with bulk hash assignment
1 parent 50cd5aa commit ea70e6e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

euler/prob029-gerdr.pl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
# find bases which are powers of a preceeding root base
1414
# store decomposition into base and exponent relative to root
1515
for 2..Int(sqrt A) -> \a {
16-
for 2..* Z a**2, a**3, a**4 ...^ * > A -> \e, \p {
17-
%powers{a} //= (a) => 1;
18-
%powers{p} //= (a) => e;
19-
}
16+
next if a ~~ %powers;
17+
%powers{a, a**2, a**3 ...^ * > A} = a X=> 1..*;
2018
}
2119

2220
# count duplicates

0 commit comments

Comments
 (0)