The first, 50, terms of the sequence enumerating permutations of length n suc\ h that |pi[i+5]-pi[i]| is never 5 are [1, 2, 6, 24, 120, 672, 4128, 28992, 231936, 2088960, 20434944, 221871360, 2645370624, 34344038400, 482103767040, 7269498483456, 117240911729664, 2013265377314688, 36665783917283328, 705762463906133760, 14313891805008665856, 305058200866133496192, 6815052066896539474560, 159241382359638761724672, 3883921082001847040221440, 98699868661535185749114624, 2608949810397316102581264000, 71622186742768413689449287552, 2039124039527206695305943379200, 60128636818742572091828821973760, 1834125525117506833382949381816576, 57808498790020661970656015543954304, 1880646302176977415309283405157735552, 63087438203981016641562457251807096576, 2180185294898959731419619368810528298240, 77549229163828853597972920846931232317184, 2836848811167470025902536150592499417336960, 106642644947448725710055247245890264495920000, 4116628209806113469428707515857149702519259392, 163066790634733919894992999634610664894428629760, 6623925180895741094555642819931481074970225049856, 275752050231190603966661231196874829453787350659968, 11757538084172715269956450158137439255668036134694016, 513170516348942479904033294814738996628656401048461056, 22914985443156415514045218373982436375943375502024234240, 1046322988333048044923089654820852427812577760517749430016, 48829917574082286636152513872503988724848599908406007616640, 2327959318184085117777130658054123303305815250037555430705024, 113328163785756071344174854474263599965779017303294208752689408, 5630999643418367939475904893793538098552725610904063075064840960] ------------------------ This took , 2854.251, second