There is a related question with an answer providing code on MSE.
I'll use my code posted there also here:
F = GF(2)
Q8 = QuaternionGroup()
A = GroupAlgebra(Q8, F)
elements = [sum(f*A(q) for f, q in zip(f8, list(Q8)))
for f8 in cartesian_product([F, F, F, F, F, F, F, F])]
nilpotents = [a for a in elements if a^1024 == A(0)]
nilpotents_with_their_index = [] # and we append
for a in nilpotents:
for power in [1..1024]:
if a^power == A(0):
nilpotents_with_their_index.append((a, power))
break # the last loop on power and consider next a, if any more
The code is not optimal, but written so that it can be digested, and the few seconds do not make any difference.
We have (after a copy+paste into the sage-ipython-interpreter, followed by a dialog with this code consumer):
sage: len(nilpotents)
128
sage: len(nilpotents_with_their_index)
128
sage: len(elements)
256
We can sort w.r.t. the index, and ask for the maximal index, and how many elements have each index:
sage: nilpotents_with_their_index.sort(key=lambda tup: tup[1])
sage: powers = list(set(tup[1] for tup in nilpotents_with_their_index))
sage: powers
[1, 2, 3, 4]
sage: for power in powers:
....: print(f"Nilpotency Index = {power} :: "
....: f"{len([tup for tup in nilpotents_with_their_index if tup[1] == power])}"
....: f" element(s)")
....:
Nilpotency Index = 1 :: 1 element(s)
Nilpotency Index = 2 :: 15 element(s)
Nilpotency Index = 3 :: 16 element(s)
Nilpotency Index = 4 :: 96 element(s)
Note that the nilpotent elements are exactly the elements with augmentation zero:
sage: def aug(a): return sum(a.coefficients() + [A(0)])
sage: set(aug(a) for a in nilpotents)
{0}
sage: set(aug(a) for a in elements if a not in nilpotents)
{()}
sage: # is this last result the set { A(1) }?
sage: _ == set([ A(1) ])
True
Please always give all information you have on a specific issue, here and elsewhere. If there is already a piece of code or a structural insight, then provide the code, the adjacent mathematical results and/or the links.