Data update

This commit is contained in:
Ingy döt Net 2025-02-27 18:35:13 -05:00
parent 8e4e15fa56
commit 72eb4943cb
1853 changed files with 35514 additions and 9441 deletions

View file

@ -0,0 +1,35 @@
// Periodic table
using System;
class PeriodicTable
{
private static readonly int[] aArray = {1, 2, 5, 13, 57, 72, 89, 104};
private static readonly int[] bArray = {-1, 15, 25, 35, 72, 21, 58, 7};
public void RowAndColumn(int n, out int r, out int c)
{
int i = 7;
while (aArray[i] > n)
i--;
int m = n + bArray[i];
r = m / 18 + 1;
c = m % 18 + 1;
}
}
class Program
{
public static void Main()
{
PeriodicTable pt = new PeriodicTable();
// Example elements (atomic numbers).
int[] nums = new int[]{1, 2, 29, 42, 57, 58, 72, 89, 90, 103};
foreach (var n in nums)
{
int r, c;
pt.RowAndColumn(n, out r, out c);
Console.Write(String.Format("{0,3:###} ->", n));
Console.WriteLine(String.Format("{0,2:##}{1,3:###}", r, c));
}
}
}

View file

@ -0,0 +1,24 @@
// Periodic table
class PeriodicTable {
constructor() {
this.aArray = [1, 2, 5, 13, 57, 72, 89, 104];
this.bArray = [-1, 15, 25, 35, 72, 21, 58, 7];
}
rowAndColumn(n) {
var i = 7;
while (this.aArray[i] > n)
i--;
var m = n + this.bArray[i];
return [Math.floor(m / 18) + 1, m % 18 + 1];
}
}
pt = new PeriodicTable();
// Example elements (atomic numbers).
for (var n of [1, 2, 29, 42, 57, 58, 72, 89, 90, 103]) {
[r, c] = pt.rowAndColumn(n);
console.log(n.toString().padStart(3, ' ') + " ->" +
r.toString().padStart(2, ' ') + c.toString().padStart(3, ' '));
}

View file

@ -0,0 +1,22 @@
module Periodic_table {
Dim Element() As Integer
Element()= (1, 2, 29, 42, 57, 58, 59, 71, 72, 89, 90, 103, 113)
For I = 0 To len(Element())-1
MostarPos(Element(I))
Next I
Sub MostarPos(N As Integer)
Local Integer M, I, R, C
Local A() as integer, B() as integer
A() = (1, 2, 5, 13, 57, 72, 89, 104)
B() = (-1, 15, 25, 35, 72, 21, 58, 7)
I = 7
While A(I) > N
I -= 1
End While
M = N + B(I)
R = (M Div 18) +1
C = (M Mod 18) +1
Print format$("Atomic number {0:-3} -> {1}, {2}", N, R, C)
End Sub
}
Periodic_table

View file

@ -0,0 +1,39 @@
MODULE PeriodicTable;
FROM STextIO IMPORT
WriteLn, WriteString;
FROM SWholeIO IMPORT
WriteInt;
TYPE
TAB = ARRAY [0 .. 7] OF INTEGER;
TANum = ARRAY [0 .. 9] OF INTEGER;
CONST
A = TAB{1, 2, 5, 13, 57, 72, 89, 104};
B = TAB{-1, 15, 25, 35, 72, 21, 58, 7};
PROCEDURE ShowRowAndColumn(ANum: INTEGER);
VAR
I, M, R, C: CARDINAL;
BEGIN
I := 7;
WHILE A[I] > ANum DO
I := I - 1
END;
M := ANum + B[I];
R := M DIV 18 + 1;
C := M MOD 18 + 1;
WriteInt(ANum, 3);
WriteString(" ->");
WriteInt(R, 2);
WriteInt(C, 3);
WriteLn;
END ShowRowAndColumn;
VAR
J : CARDINAL;
ANum: TANum; (* Example elements (atomic numbers) *)
BEGIN
ANum := TANum{1, 2, 29, 42, 57, 58, 72, 89, 90, 103};
FOR J := 0 TO 9 DO
ShowRowAndColumn(ANum[J])
END
END PeriodicTable.