RosettaCodeData/Task/Periodic-table/Mathematica/periodic-table.math

16 lines
439 B
Plaintext

ClearAll[FindPeriodGroup]
FindPeriodGroup[n_Integer] := Which[57 <= n <= 70,
{8, n - 53}
,
89 <= n <= 102,
{9, n - 85}
,
1 <= n <= 118,
{ElementData[n, "Period"], ElementData[n, "Group"]}
,
True,
Missing["Element does not exist"]
]
Row[{"Element ", #, " -> ", FindPeriodGroup[#]}] & /@ {1, 2, 29, 42, 57, 58, 59, 71, 72, 89, 90, 103, 113} // Column
Graphics[Text[#, {1, -1} Reverse@FindPeriodGroup[#]] & /@ Range[118]]