aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-079/jeongoon/raku/ch-1.raku2
-rw-r--r--challenge-079/jeongoon/raku/ch-1.short.raku2
2 files changed, 1 insertions, 3 deletions
diff --git a/challenge-079/jeongoon/raku/ch-1.raku b/challenge-079/jeongoon/raku/ch-1.raku
index 8d2b049927..7e52b7b8e7 100644
--- a/challenge-079/jeongoon/raku/ch-1.raku
+++ b/challenge-079/jeongoon/raku/ch-1.raku
@@ -10,7 +10,6 @@ our &naive = {[+] (.base(2).indices(1).elems for ^$_[0]+1)};
# this is the rule what I found. I guess this is not bad.
sub sum-a-section ($m) {
state @K = 1, 3;
- say "{@K}";
# summation of the counts of bits between 2**(m) .. 2**(m+1)-1
@K[$m]:exists ?? @K[$m] !! ( @K[$m] = [+] (1+<$m), |@K[0..$m-1] );
}
@@ -28,7 +27,6 @@ sub count-set-bits ( UInt \N ) {
++$m while $N +>= 1;
$N = N - (1+<$m);
- say "??? {$N}";
$sum += sum-upto-power2($m);
$N == 0 ?? $sum !! $sum + $N + count-set-bits($N);
}
diff --git a/challenge-079/jeongoon/raku/ch-1.short.raku b/challenge-079/jeongoon/raku/ch-1.short.raku
index e758c706c2..034f16a8f3 100644
--- a/challenge-079/jeongoon/raku/ch-1.short.raku
+++ b/challenge-079/jeongoon/raku/ch-1.short.raku
@@ -1 +1 @@
-our &MAIN=&say∘(*%(10**9+7))∘{[+] (.base(2).indices(1).elems for ^$_[0]+1)}
+our &MAIN=&say∘(*%(10**9+7))∘{[+] (.base(2).comb.sum for ^$^i+1)}