prime exp(v) = { my (x = []); forprime (p = 2, oo, if (v==1, return (x), x = concat(x, valuation(v, p)); v /= p^x[#x]; ); ); } mix(a, b) = vector(max(#a, #b), n, if (n <= #a, a[n], 0) + if (n <= #b, b[n], 0)) apex(i, j) = { my (v = []); for (k = i, j, v = mix(v, binomial(j-i, k-i) * f[k]); ); return (v); } { for (n = 1, #f = vector(100), for (v = 2, oo, f[n] = prime exp(v); r = vector(n, i, apex(i, n)); ok = 1; for (i = 1, n-1, for (j = i, n-1, m = apex(i, j); for (k = 1, n, if (m==r[k], ok = 0; break (3); ); ); ); ); if (ok, print (n " " v); break; ); ); ); } quit