Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
24
Task/Multifactorial/PowerShell/multifactorial.ps1
Normal file
24
Task/Multifactorial/PowerShell/multifactorial.ps1
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Multifactorial
|
||||
function Get-Multifactorial {
|
||||
param(
|
||||
[uint32]$N,
|
||||
[uint32]$Degree
|
||||
)
|
||||
if ($N -lt 2) {
|
||||
return 1
|
||||
} else {
|
||||
[uint64]$result = $N
|
||||
for ($i = $N - $Degree; $i -ge 2; $i -= $Degree) {
|
||||
$result *= $i
|
||||
}
|
||||
return $result
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($degree in 1..5) {
|
||||
$out = "Degree $degree =>"
|
||||
foreach ($n in 1..10) {
|
||||
$out += " $(Get-Multifactorial $n $degree)"
|
||||
}
|
||||
Write-Output $out
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue