Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,35 +0,0 @@
|
|||
function isEven {
|
||||
param ([int]$value)
|
||||
return [bool]($value % 2 -eq 0)
|
||||
}
|
||||
|
||||
function doubleValue {
|
||||
param ([int]$value)
|
||||
return [int]($value * 2)
|
||||
}
|
||||
|
||||
function halveValue {
|
||||
param ([int]$value)
|
||||
return [int]($value / 2)
|
||||
}
|
||||
|
||||
function multiplyValues {
|
||||
param (
|
||||
[int]$plier,
|
||||
[int]$plicand,
|
||||
[int]$temp = 0
|
||||
)
|
||||
|
||||
while ($plier -ge 1)
|
||||
{
|
||||
if (!(isEven $plier)) {
|
||||
$temp += $plicand
|
||||
}
|
||||
$plier = halveValue $plier
|
||||
$plicand = doubleValue $plicand
|
||||
}
|
||||
|
||||
return $temp
|
||||
}
|
||||
|
||||
multiplyValues 17 34
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
function halveInt( [int] $rhs )
|
||||
{
|
||||
[math]::floor( $rhs / 2 )
|
||||
}
|
||||
|
||||
function doubleInt( [int] $rhs )
|
||||
{
|
||||
$rhs*2
|
||||
}
|
||||
|
||||
function isEven( [int] $rhs )
|
||||
{
|
||||
-not ( $_ % 2 )
|
||||
}
|
||||
|
||||
function Ethiopian( [int] $lhs , [int] $rhs )
|
||||
{
|
||||
$scratch = @{}
|
||||
1..[math]::floor( [math]::log( $lhs , 2 ) + 1 ) |
|
||||
ForEach-Object {
|
||||
$scratch[$lhs] = $rhs
|
||||
$lhs
|
||||
$lhs = halveInt( $lhs )
|
||||
$rhs = doubleInt( $rhs ) } |
|
||||
Where-Object { -not ( isEven $_ ) } |
|
||||
ForEach-Object { $sum = 0 } { $sum += $scratch[$_] } { $sum }
|
||||
}
|
||||
|
||||
Ethiopian 17 34
|
||||
Loading…
Add table
Add a link
Reference in a new issue