2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -0,0 +1,18 @@
# Start with a pool large enough to meet the requirements
$Pool = [System.Collections.ArrayList]( 2..22000 )
# Start with 1, because it's grandfathered in
$Ludic = @( 1 )
# While the size of the pool is still larger than the next Ludic number...
While ( $Pool.Count -gt $Pool[0] )
{
# Add the next Ludic number to the list
$Ludic += $Pool[0]
# Remove from the pool all entries whose index is a multiple of the next Ludic number
[math]::Truncate( ( $Pool.Count - 1 )/ $Pool[0])..0 | ForEach { $Pool.RemoveAt( $_ * $Pool[0] ) }
}
# Add the rest of the numbers in the pool to the list of Ludic numbers
$Ludic += $Pool.ToArray()

View file

@ -0,0 +1,15 @@
# Display the first 25 Ludic numbers
$Ludic[0..24] -join ", "
''
# Display the count of all Ludic numbers under 1000
$Ludic.Where{ $_ -le 1000 }.Count
''
# Display the 2000th through the 2005th Ludic number
$Ludic[1999..2004] -join ", "
''
# Display all Ludic triplets less than 250
$TripletStart = $Ludic.Where{ $_ -lt 244 -and ( $_ + 2 ) -in $Ludic -and ( $_ + 6 ) -in $Ludic }
$TripletStart.ForEach{ $_, ( $_ + 2 ), ( $_ + 6 ) -join ", " }