The first, 40, terms of the sequence enumerating permutations of length n suc\ h that pi[i+3]-pi[i] is never 4 are or equivalently, such that pi[i+4]-pi[i] is never 3, are [1, 2, 6, 24, 108, 588, 3768, 28032, 237024, 2252460, 23751072, 274983552, 3466724112, 47252955456, 692321814144, 10848815656704, 181035316685424, 3204767043076320, 59981575683074400, 1183379432694727104, 24544072318504622400, 533866158175176897120, 12151412059886415338976, 288842063166373485029184, 7157123228966286264597792, 184557216285772760437690464, 4944990987860216238553374720, 137473872218020872340608302784, 3960212343622024003641964772064, 118065851255846195021860880196960, 3638629309563846885184822445273856, 115795547778291329977944856503475968, 3801446422084112421525611126996320128, 128616921438443663423241266743387508640, 4480776208614890038584920347805200701984, 160601754048375273732337973685245134102656, 5917599801365546063340453195639552065304384, 223982606988871416393136444677250082193209568, 8702594540452708815177045624444277358324332512, 346862379592138836041844801500892816777938311296] --------------------------------- This took, 2161.181, seconds.