Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,10 +0,0 @@
|
|||
function Catalan([uint64]$m) {
|
||||
function fact([bigint]$n) {
|
||||
if($n -lt 2) {[bigint]::one}
|
||||
else{2..$n | foreach -Begin {$prod = [bigint]::one} -Process {$prod = [bigint]::Multiply($prod,$_)} -End {$prod}}
|
||||
}
|
||||
$fact = fact $m
|
||||
$fact1 = [bigint]::Multiply($m+1,$fact)
|
||||
[bigint]::divide((fact (2*$m)), [bigint]::Multiply($fact,$fact1))
|
||||
}
|
||||
0..15 | foreach {"catalan($_): $(catalan $_)"}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
function Get-CatalanNumber
|
||||
{
|
||||
[CmdletBinding()]
|
||||
[OutputType([PSCustomObject])]
|
||||
Param
|
||||
(
|
||||
[Parameter(Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0)]
|
||||
[uint32[]]
|
||||
$InputObject
|
||||
)
|
||||
|
||||
Begin
|
||||
{
|
||||
function Get-Factorial ([int]$Number)
|
||||
{
|
||||
if ($Number -eq 0)
|
||||
{
|
||||
return 1
|
||||
}
|
||||
|
||||
$factorial = 1
|
||||
|
||||
1..$Number | ForEach-Object {$factorial *= $_}
|
||||
|
||||
$factorial
|
||||
}
|
||||
|
||||
function Get-Catalan ([int]$Number)
|
||||
{
|
||||
if ($Number -eq 0)
|
||||
{
|
||||
return 1
|
||||
}
|
||||
|
||||
(Get-Factorial (2 * $Number)) / ((Get-Factorial (1 + $Number)) * (Get-Factorial $Number))
|
||||
}
|
||||
}
|
||||
Process
|
||||
{
|
||||
foreach ($number in $InputObject)
|
||||
{
|
||||
[PSCustomObject]@{
|
||||
Number = $number
|
||||
CatalanNumber = Get-Catalan $number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
0..14 | Get-CatalanNumber
|
||||
|
|
@ -1 +0,0 @@
|
|||
(0..14 | Get-CatalanNumber).CatalanNumber
|
||||
Loading…
Add table
Add a link
Reference in a new issue