Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
22
Task/Periodic-table/PowerShell/periodic-table.ps1
Normal file
22
Task/Periodic-table/PowerShell/periodic-table.ps1
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Periodic table
|
||||
|
||||
[int[]]$script:A = 1, 2, 5, 13, 57, 72, 89, 104
|
||||
[int[]]$script:B = -1, 15, 25, 35, 72, 21, 58, 7
|
||||
|
||||
function Show-Row-And-Column([int]$ANum) {
|
||||
[uint32]$i = 7
|
||||
while ($script:A[$i] -gt $ANum) {
|
||||
$i--
|
||||
}
|
||||
[uint32]$m = $ANum + $script:B[$i]
|
||||
[uint32]$r = [Math]::Floor($m / 18) + 1
|
||||
[uint32]$c = $m % 18 + 1
|
||||
[string] $out = "{0, 3} ->{1, 2}{2, 3}" -f $ANum, $r, $c
|
||||
Write-Output $out
|
||||
}
|
||||
|
||||
# Example elements (atomic numbers)
|
||||
[int[]]$aNum = 1, 2, 29, 42, 57, 58, 72, 89, 90, 103
|
||||
foreach ($an in $aNum) {
|
||||
Show-Row-And-Column($an)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue