Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,25 +0,0 @@
|
|||
function Test-Kaprekar ([int]$Number)
|
||||
{
|
||||
if ($Number -eq 1)
|
||||
{
|
||||
return $true
|
||||
}
|
||||
|
||||
[int64]$a = $Number * $Number
|
||||
[int64]$b = 10
|
||||
|
||||
while ($b -lt $a)
|
||||
{
|
||||
[int64]$remainder = $a % $b
|
||||
[int64]$quotient = ($a - $remainder) / $b
|
||||
|
||||
if ($remainder -gt 0 -and $remainder + $quotient -eq $Number)
|
||||
{
|
||||
return $true
|
||||
}
|
||||
|
||||
$b *= 10
|
||||
}
|
||||
|
||||
return $false
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
"Kaprekar numbers less than 10,000:"
|
||||
1..10000 | ForEach-Object {if (Test-Kaprekar -Number $_) {"{0,6}" -f $_}} | Format-Wide {$_} -Column 17 -Force
|
||||
|
||||
"Kaprekar numbers less than 1,000,000:"
|
||||
1..1000000 | ForEach-Object {if (Test-Kaprekar -Number $_) {"{0,6}" -f $_}} | Format-Wide {$_} -Column 18 -Force
|
||||
Loading…
Add table
Add a link
Reference in a new issue