aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Proctor <simon.proctor@zpg.co.uk>2020-02-25 11:39:22 +0000
committerSimon Proctor <simon.proctor@zpg.co.uk>2020-02-25 11:39:22 +0000
commit957a83cede7fcd913c8849a58fa18b62453d115a (patch)
treeb12094854b2df57512c97907cb17c1d64cd90676
parent3dbb9a3609c00c76109fda5f9c02188b5f31f767 (diff)
downloadperlweeklychallenge-club-957a83cede7fcd913c8849a58fa18b62453d115a.tar.gz
perlweeklychallenge-club-957a83cede7fcd913c8849a58fa18b62453d115a.tar.bz2
perlweeklychallenge-club-957a83cede7fcd913c8849a58fa18b62453d115a.zip
Sudden ephiany
-rw-r--r--challenge-049/simon-proctor/raku/ch-1.p610
1 files changed, 9 insertions, 1 deletions
diff --git a/challenge-049/simon-proctor/raku/ch-1.p6 b/challenge-049/simon-proctor/raku/ch-1.p6
index 82a55473f7..7e05281b98 100644
--- a/challenge-049/simon-proctor/raku/ch-1.p6
+++ b/challenge-049/simon-proctor/raku/ch-1.p6
@@ -6,5 +6,13 @@ use v6.d;
sub MAIN(
UInt $x #= Number to look for multiple of
) {
- ( $x, * + $x...* ).hyper.first( { $_ ~~ m!^ <[10]>+ $! } ).say;
+ my $current = 1;
+ my $current-bin = $current.base(2);
+
+ while ( ! ( $current-bin %% $x ) ) {
+ $current++;
+ $current-bin = $current.base(2);
+ }
+
+ say $current-bin;
}