From 0917eb8a62a941900e9505782cf33a9960ef86ea Mon Sep 17 00:00:00 2001 From: Myoungjin JEON Date: Thu, 24 Sep 2020 23:51:06 +1000 Subject: [ch-079/jeongoon] ch-1.raku: remove debug codes --- challenge-079/jeongoon/raku/ch-1.raku | 2 -- challenge-079/jeongoon/raku/ch-1.short.raku | 2 +- 2 files changed, 1 insertion(+), 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)} -- cgit