The first, 40, terms of the sequence enumerating permutations of length n suc\ h that |pi[i+1]-pi[i]| is never 3 are [1, 2, 6, 12, 48, 240, 1392, 9936, 82416, 771888, 8081808, 93273936, 1174442160 , 16012371024, 234865643952, 3686260363152, 61627946597424, 1093150647044880, 20501844922196976, 405313119744707088, 8423466060115604208, 183582624178893950736, 4186520700374895202800, 99697398784352956533264, 2474726013785813664809712, 63922390767402268644275472, 1715494609619150973923837424, 47765601143125284027333699600, 1378019056802003925032691803376, 41140957260201936774910629270288, 1269621356542581523858076478997488, 40456554044839072756053456871907856, 1329787192395500824652210272792036080, 45044787117856597054242189974468672784, 1571053564430232969803502831535786812912, 56371380975109997056989155079530246030352, 2079242307098121808502148034465480113921264, 78778275552637636413124897188544942259988240, 3063769839885645468785458202906512102484150256, 122225915058193279524873554022534028571777910288] --------------------------------- This took, 1189.549, seconds.