aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyoungjin JEON <jeongoon@gmail.com>2020-09-24 23:51:06 +1000
committerMyoungjin JEON <jeongoon@gmail.com>2020-09-24 23:51:06 +1000
commit0917eb8a62a941900e9505782cf33a9960ef86ea (patch)
treef4b482b2103c8c1b0b167001ca1677982abbe5a7
parent416dcc46b9df7e364f87d5d7c07f53f646ffb6a8 (diff)
downloadperlweeklychallenge-club-0917eb8a62a941900e9505782cf33a9960ef86ea.tar.gz
perlweeklychallenge-club-0917eb8a62a941900e9505782cf33a9960ef86ea.tar.bz2
perlweeklychallenge-club-0917eb8a62a941900e9505782cf33a9960ef86ea.zip
[ch-079/jeongoon] ch-1.raku: remove debug codes
-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)}