The first, 40, terms of the sequence enumerating permutations of length n suc\ h that pi[i+3]-pi[i] is never 5 are or equivalently, such that pi[i+5]-pi[i] is never 3, are [1, 2, 6, 24, 120, 648, 4140, 30624, 258048, 2440320, 25575432, 294579936, 3696916704, 50193365952, 732874685760, 11449410148224, 190535561333568, 3364607458730880, 62831761039377984, 1237070353963472640, 25609485055819680000, 556079014498954710528, 12636858676373038090752, 299938993470832215133440, 7421938409336391322940160, 191142680054948627730304320, 5115371547379381273857350880, 142053029209670549556331592160, 4087877741026536072204865241280, 121753222860217367846538990095040, 3748831318546325762887597165030080, 119199621671052293866922869679543520, 3910010205780464814165525284587356000, 132188135474458014769343383078808750400, 4601832178741036349715351245526453365760, 164826633167513935718229487849489430065920, 6069283948589757903343449806208440162545440, 229580492061188108173550591022137673095518560, 8914793877292337560646638014001986640924001280, 355118872315389607691338351518713619951083216640] --------------------------------- This took, 1554.341, seconds.