------------------------------- The first, 40, terms of the sequence enumerating permutations of length n suc\ h that |pi[i+1]-pi[i]| is never 4 are [1, 2, 6, 24, 72, 336, 1968, 13824, 108576, 984384, 10043136, 113503104, 1402567296, 18832274304, 272726752896, 4234471319424, 70133725042176, 1233957395147904, 22978202678405376, 451410202541445504, 9328760137717174656, 202286213379848025984, 4591998179277737298816, 108900098221191261220224, 2692931675159627657460096, 69317456659965888949947264, 1854347727009367454707334016, 51479691659707251175627684224, 1481117293141865400226764245376, 44106905935591073089530026811264, 1357938266633712135123347668050816, 43175396526747732761264814217467264, 1416226302357937776896372974282110336, 47879958565035342375278019873846766464, 1666899920670016233503431988939671936896, 59708015987896689535029853556390165975424, 2198754185430135170482227099016003274637696, 83179120558510325668061353378692316109944704, 3230247592880992753064940356634389978588109696, 128690811088961126592261448216610445035238927744] --------------------------------- This took, 690.852, seconds.