\\ L -> [ [v,#]* ] uniq(L) = { \\ # of transitions my (t=0); for (k=1, #L-1, if (L[k]!=L[k+1], t++; ); ); my (u=vector(t+1,r,[0,0])); if (#L, u[1][1]=L[1]; my (r=1); for (k=1, #L, if (u[r][1]!=L[k], u[r++][1]=L[k]; ); u[r][2]++; ); ); u } a(n) = { my (f=factor(n), o=#f~, w=if (o, primepi(f[o,1]), 0), e=vector(w, k, valuation(n, prime(w+1-k))), u=uniq(e)); prod (k=1, #u, prime(2*#u+1-2*k)^u[k][1] * prime(2*#u+2-2*k)^u[k][2] ); } for (n=1, 10 000, print (n " " a(n))) quit