### Steenrod Calculator

This is a Steenrod calculator. A Steenrod square is input like "Sq5" or "P5". The Milnor primitives are written like "Q2". In particular, at an odd prime the Bockstein is currently written "Q0". The Milnor basis elements are denoted like "Sq(0,1)" which is the same as "Q1" at the prime 2 or "P(0,0,1)" which is $[[P^1,P^p],P^{p^2}]$.

In order to multiply two elements you MUST include a "*" between them, for instance "Sq4*Sq2*Sq1". You can use parentheses for grouping as in "(Q2 + Sq7)*Sq2". Input can be an arbitrary homogenous arithmetic expression using +, -, *, and parentheses in these generators. Scalars are denoted like "2*P2". "P1*P1*2", or "-P1*P1" or "P1*P1*-1" are all valid notations.

For convenience, we also allow the notation "A(2 2 2 2)" for $Sq^2 Sq^2 Sq^2 Sq^2$ and "A(1 b 1)" for "P^1 \beta P^1". The letter "A" here stands for "admissible", though of course the sequences involved are not admissible. We also allow "M(0 0 2)" as an alternate notation for "P(0, 0, 2)" or "Sq(0,0,2)".

Prime:
Output Basis:
The Adem relation is $\displaystyle\def\P{\mathrm{P}} \P^i \beta^{\epsilon} \P^j = \sum_{\epsilon_1+\epsilon_2 = \epsilon}\sum_{k=0}^{i/p} \binom{(j-k)(p-1) + \epsilon_1 - 1 }{i-pj-\epsilon_2} \beta^{\epsilon_1}\P^{i+j-k}\beta^{\epsilon_2}\P^{k}$