The first, 40, terms of the sequence enumerating permutations of length n suc\ h that pi[i+2]-pi[i] is never 5 are or equivalently, such that pi[i+5]-pi[i] is never 2 are [1, 2, 6, 24, 120, 624, 3924, 28872, 243000, 2300400, 24167568, 279023304, 3509619516, 47753201520, 698671018800, 10935962501040, 182320112891244, 3225007044151920, 60320872398593520, 1189409881438465200, 24657336563892214320, 536107748312711193840, 12198034660050905063760, 289858734809832170896560, 7180316976935747731993200, 185109690046459699927614960, 4958706722719910677688255760, 137828173626994026054443952240, 3969720768097901037099011022000, 118330586164337120152004632057200, 3646266086813819503966075150279920, 116023515934738573719029204441259120, 3808480511633067964784081576769944400, 128841024534553338234186345524240459760, 4488140988744565253410974825600082714800, 160851176655965581555879890019442493084720, 5926297255727660595250862826998126466545040, 224294615923873615246072243802109056486425200, 8714100393025508666647261303224097811914623600, 347298216862180671807628947335967345820465086000] --------------------------------- This took, 2044.465, seconds.