Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
6
Task/Population-count/PowerShell/population-count.psh
Normal file
6
Task/Population-count/PowerShell/population-count.psh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
function pop-count($n) {
|
||||
(([Convert]::ToString($n, 2)).toCharArray() | where {$_ -eq '1'}).count
|
||||
}
|
||||
"pop_count 3^n: $(1..29 | foreach -Begin {$n = 1; (pop-count $n)} -Process {$n = 3*$n; (pop-count $n)} )"
|
||||
"even pop_count: $($m = $n = 0; while($m -lt 30) {if(0 -eq ((pop-count $n)%2)) {$m += 1; $n}; $n += 1} )"
|
||||
"odd pop_count: $($m = $n = 0; while($m -lt 30) {if(1 -eq ((pop-count $n)%2)) {$m += 1; $n}; $n += 1} )"
|
||||
Loading…
Add table
Add a link
Reference in a new issue