import numberdb.sage as numberdb
from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
R = PolynomialRing(ZZ, "x")
x = R.gen()
def shapiro_pair(n):
P = R.one()
Q = R.one()
for k in range(n):
P, Q = P + x**(2**k)*Q, P - x**(2**k)*Q
return P, Q
shapiro_pair(8)[1] # the next polynomial after this tableThe generator computes $P_n$ and $Q_n$ by the exact recurrence in $\mathbb Z[x]$.
Every entry was checked against the direct Golay-Rudin-Shapiro coefficient construction in (3) and the reciprocal relation in (1), against the first three $Q_n$ polynomials printed by [1], against the complementary identity in (2), against the aperiodic autocorrelations in (4), against the recurrence in (5), and against the specialisations in (6).