The first, 40, terms of the sequence enumerating permutations of length n suc\ h that pi[i+4]-pi[i] is never 4 are [1, 2, 6, 24, 114, 628, 4062, 30360, 255186, 2414292, 25350954, 292378968, 3673917102, 49928069188, 729534877758, 11403682481112, 189862332575658, 3354017704180052, 62654508729565554, 1233924707891272728, 25550498290562247438, 554913370184289495780, 12612648556263898345758, 299411750583810718488216, 7409924986737790240296258, 190856850583975937020030228, 5108283222440036893650974970, 141870112250977140975169694808, 4082973503947066134710463043374, 121616802487841972048586204012740, 3744899397363811580125047321071934, 119082343961934371268047348260787928, 3906394323729047896372054813609731738, 132073019281315044040357960799728514580, 4598051703085723629021521115097009617090, 164698684622791948865479761971150102229528, 6064825145177982610574856236858905067695950, 229420634696668968001790413123421777141042404, 8908902242217781803662578524801135304840564830, 354895821406788171643098383643659158922659803288] --------------------------------- This took, 1324.418, seconds.