Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,34 +0,0 @@
function Get-NextAliquot ( [int]$X )
{
If ( $X -gt 1 )
{
$NextAliquot = 0
(1..($X/2)).Where{ $x % $_ -eq 0 }.ForEach{ $NextAliquot += $_ }.Where{ $_ }
return $NextAliquot
}
}
function Get-AliquotSequence ( [int]$K, [int]$N )
{
$X = $K
$X
(1..($N-1)).ForEach{ $X = Get-NextAliquot $X; $X }
}
function Classify-AlliquotSequence ( [int[]]$Sequence )
{
$K = $Sequence[0]
$LastN = $Sequence.Count
If ( $Sequence[-1] -eq 0 ) { return "terminating" }
If ( $Sequence[-1] -eq 1 ) { return "terminating" }
If ( $Sequence[1] -eq $K ) { return "perfect" }
If ( $Sequence[2] -eq $K ) { return "amicable" }
If ( $Sequence[3..($Sequence.Count-1)] -contains $K ) { return "sociable" }
If ( $Sequence[-1] -eq $Sequence[-2] ) { return "aspiring" }
If ( $Sequence.Count -gt ( $Sequence | Select -Unique ).Count ) { return "cyclic" }
return "non-terminating and non-repeating through N = $($Sequence.Count)"
}
(1..10).ForEach{ [string]$_ + " is " + ( Classify-AlliquotSequence -Sequence ( Get-AliquotSequence -K $_ -N 16 ) ) }
( 11, 12, 28, 496, 220, 1184, 790, 909, 562, 1064, 1488 ).ForEach{ [string]$_ + " is " + ( Classify-AlliquotSequence -Sequence ( Get-AliquotSequence -K $_ -N 16 ) ) }

View file

@ -1,63 +0,0 @@
function Get-NextAliquot ( [int]$X )
{
If ( $X -gt 1 )
{
$NextAliquot = 1
If ( $X -gt 2 )
{
$XSquareRoot = [math]::Sqrt( $X )
(2..$XSquareRoot).Where{ $X % $_ -eq 0 }.ForEach{ $NextAliquot += $_ + $x / $_ }
If ( $XSquareRoot % 1 -eq 0 ) { $NextAliquot -= $XSquareRoot }
}
return $NextAliquot
}
}
function Get-AliquotSequence ( [int]$K, [int]$N )
{
$X = $K
$X
$i = 1
While ( $X -and $i -lt $N )
{
$i++
$Next = Get-NextAliquot $X
If ( $Next )
{
If ( $X -eq $Next )
{
($i..$N).ForEach{ $X }
$i = $N
}
Else
{
$X = $Next
$X
}
}
Else
{
$i = $N
}
}
}
function Classify-AlliquotSequence ( [int[]]$Sequence )
{
$K = $Sequence[0]
$LastN = $Sequence.Count
If ( $Sequence[-1] -eq 0 ) { return "terminating" }
If ( $Sequence[-1] -eq 1 ) { return "terminating" }
If ( $Sequence[1] -eq $K ) { return "perfect" }
If ( $Sequence[2] -eq $K ) { return "amicable" }
If ( $Sequence[3..($Sequence.Count-1)] -contains $K ) { return "sociable" }
If ( $Sequence[-1] -eq $Sequence[-2] ) { return "aspiring" }
If ( $Sequence.Count -gt ( $Sequence | Select -Unique ).Count ) { return "cyclic" }
return "non-terminating and non-repeating through N = $($Sequence.Count)"
}
(1..10).ForEach{ [string]$_ + " is " + ( Classify-AlliquotSequence -Sequence ( Get-AliquotSequence -K $_ -N 16 ) ) }
( 11, 12, 28, 496, 220, 1184, 12496, 1264460, 790, 909, 562, 1064, 1488 ).ForEach{ [string]$_ + " is " + ( Classify-AlliquotSequence -Sequence ( Get-AliquotSequence -K $_ -N 16 ) ) }

View file

@ -1,90 +0,0 @@
function Get-Aliquot
{
[CmdletBinding()]
[OutputType([PScustomObject])]
Param
(
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
[int]
$InputObject
)
Begin
{
function Get-NextAliquot ([int]$X)
{
if ($X -gt 1)
{
$nextAliquot = 1
if ($X -gt 2)
{
$xSquareRoot = [Math]::Sqrt($X)
2..$xSquareRoot | Where-Object {$X % $_ -eq 0} | ForEach-Object {$nextAliquot += $_ + $x / $_}
if ($xSquareRoot % 1 -eq 0) {$nextAliquot -= $xSquareRoot}
}
$nextAliquot
}
}
function Get-AliquotSequence ([int]$K, [int]$N)
{
$X = $K
$X
$i = 1
while ($X -and $i -lt $N)
{
$i++
$next = Get-NextAliquot $X
if ($next)
{
if ($X -eq $next)
{
$i..$N | ForEach-Object {$X}
$i = $N
}
else
{
$X = $next
$X
}
}
else
{
$i = $N
}
}
}
function Classify-AlliquotSequence ([int[]]$Sequence)
{
$k = $Sequence[0]
if ($Sequence[-1] -eq 0) {return "terminating"}
if ($Sequence[-1] -eq 1) {return "terminating"}
if ($Sequence[1] -eq $k) {return "perfect" }
if ($Sequence[2] -eq $k) {return "amicable" }
if ($Sequence[3..($Sequence.Count-1)] -contains $k) {return "sociable" }
if ($Sequence[-1] -eq $Sequence[-2] ) {return "aspiring" }
if ($Sequence.Count -gt ($Sequence | Select -Unique).Count ) {return "cyclic" }
return "non-terminating and non-repeating through N = $($Sequence.Count)"
}
}
Process
{
$_ | ForEach-Object {
[PSCustomObject]@{
Number = $_
Classification = (Classify-AlliquotSequence -Sequence (Get-AliquotSequence -K $_ -N 16))
}
}
}
}

View file

@ -1,5 +0,0 @@
$oneToTen = 1..10 | Get-Aliquot
$selected = 11, 12, 28, 496, 220, 1184, 12496, 1264460, 790, 909, 562, 1064, 1488 | Get-Aliquot
$numbers = $oneToTen, $selected
$numbers