Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,22 @@
# Periodic table
constant a := reg(1, 2, 5, 13, 57, 72, 89, 104);
constant b := reg(-1, 15, 25, 35, 72, 21, 58, 7);
proc showrowndcolumn(anum) is
i := 8; # Register is indexed from 1.
while a[i] > anum do
i -:= 1
od;
m := anum + b[i];
r := m \ 18 + 1;
c := m symmod 18 + 1;
printf("%3d ->%2d%3d\n", anum, r, c);
end;
scope
testnums := reg(1, 2, 29, 42, 57, 58, 72, 89, 90, 103); # Example elements (atomic numbers)
for anum in testnums do
showrowndcolumn(anum)
od
epocs

View file

@ -0,0 +1,53 @@
program periodtabl(output);
var
a, b: array [0 .. 7] of integer;
procedure showrowandcolumn(anum: integer);
var
i, m, r, c: integer;
begin
i := 7;
while a[i] > anum do
i := i - 1;
m := anum + b[i];
r := m div 18 + 1;
c := m mod 18 + 1;
write(anum: 3, ' ->', r: 2, c: 3);
writeln;
end;
procedure initab;
begin
a[0] := 1;
a[1] := 2;
a[2] := 5;
a[3] := 13;
a[4] := 57;
a[5] := 72;
a[6] := 89;
a[7] := 104;
b[0] := -1;
b[1] := 15;
b[2] := 25;
b[3] := 35;
b[4] := 72;
b[5] := 21;
b[6] := 58;
b[7] := 7;
end;
begin
initab;
(* Test for example elements (atomic numbers) *)
showrowandcolumn( 1);
showrowandcolumn( 2);
showrowandcolumn( 29);
showrowandcolumn( 42);
showrowandcolumn( 57);
showrowandcolumn( 58);
showrowandcolumn( 72);
showrowandcolumn( 89);
showrowandcolumn( 90);
showrowandcolumn(103);
end.

View file

@ -0,0 +1,33 @@
local fmt = require "fmt"
local limits = {
range(3, 10), range(11, 18), range(19, 36),
range(37, 54), range(55, 86), range(87, 118)
}
local function periodic_table(n)
if n < 1 or n > 118 then error("Atomic number is out of range.") end
if n == 1 then return {1, 1} end
if n == 2 then return {1, 18} end
if 57 <= n <= 71 then return {8, n - 53} end
if 89 <= n <= 103 then return {9, n - 85} end
local row
local start
local finish
for i = 1, #limits do
local limit = limits[i]
if limit[1] <= n <= limit:back() then
row = i + 1
start = limit[1]
finish = limit:back()
break
end
end
if n < start + 2 or row == 4 or row == 5 then return {row, n - start + 1} end
return {row, n - finish + 18}
end
for {1, 2, 29, 42, 57, 58, 59, 71, 72, 89, 90, 103, 113} as n do
local rc = periodic_table(n)
fmt.print("Atomic number %3d -> %d, %-2d", n, rc[1], rc[2])
end

View 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)
}

View file

@ -0,0 +1,14 @@
D ← $ H He |
$ Li Be B C N O F Ne |
$ Na Mg Al Si P S Cl Ar |
$ K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr |
$ Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I Xe |
$ Cs Ba * Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn |
$ Fr Ra ° Rf Db Sg Bh Hs Mt Ds Rg Cn Nh Fl Mc Lv Ts Og |
$ |
$ Lantanoids* La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu |
$ Aktinoids° Ak Th Pa U Np Pu Am Cm Bk Cf Es Fm Md No Lr |
T ← ⊜∘⊸≠@\nD
Es ← ⬚@\s≡(°□⊢°□)regex"[A-Z][a-z]? "D
Es+1⇡⊸⧻≡(+1_1÷1_4⊢⊚˜⌕T)Es
≡(&p$"_ _ _")