Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,17 @@
#Create generator of extended fibonaci
Function Get-ExtendedFibonaciGenerator($InitialValues ){
$Values = $InitialValues
{
#exhaust initial values first before calculating next values by summation
if ($InitialValues.Length -gt 0) {
$NextValue = $InitialValues[0]
$Script:InitialValues = $InitialValues | Select -Skip 1
return $NextValue
}
$NextValue = $Values | Measure-Object -Sum | Select -ExpandProperty Sum
$Script:Values = @($Values | Select-Object -Skip 1) + @($NextValue)
$NextValue
}.GetNewClosure()
}

View file

@ -0,0 +1,10 @@
$Name = 'fibo tribo tetra penta hexa hepta octo nona deca'.Split()
0..($Name.Length-1) | foreach { $Index = $_
$InitialValues = @(1) + @(foreach ($I In 0..$Index) { [Math]::Pow(2,$I) })
$Generator = Get-ExtendedFibonaciGenerator $InitialValues
[PSCustomObject] @{
n = $InitialValues.Length;
Name = "$($Name[$Index])naci";
Sequence = 1..15 | foreach { & $Generator } | Join-String -Separator ','
}
} | Format-Table -AutoSize