I am wondering, polynomials like

$S_n^4-6n S_n^2+3n^2+2n$ for $$S_n=\sum_{i=1}^n{X_i}$$ where $$\mathbb{P}(X_i=1)=\mathbb{P}(X_i=-1)=\frac{1}{2}$$ is a martingale (under the conventional filtration). While $$B_t^4-6t B_t^2+3t^2$$ for Brownian motion $B_t$ is also a martingale. 

Note the difference between the two, and the similarity!

What's the general conclusion about the polynomials of $S_n$ and $n$, also about $B_t$ and $t$, to make them into martingales?

Thanks.