March 2014 update

This commit is contained in:
Ingy döt Net 2014-04-02 16:56:35 +00:00
parent 09687c4926
commit a25938f123
1846 changed files with 21876 additions and 5203 deletions

View file

@ -0,0 +1,26 @@
# Author M. McNabb
function Get-HailStoneBelowLimit {
param($UpperLimit)
begin {
function Get-HailStone {
param($n)
switch($n) {
1 {$n;return}
{$n % 2 -eq 0} {$n; return Get-Hailstone ($n = $n / 2)}
{$n % 2 -ne 0} {$n; return Get-Hailstone ($n = ($n * 3) +1)}
}
}
$Counts = @()
}
process {
for ($i = 1; $i -lt $UpperLimit; $i++) {
$Object = [pscustomobject]@{
'Number' = $i
'Count' = (Get-HailStone $i).count
}
$Counts += $Object
}
}
end {$Counts}
}