The first, 40, 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, 696, 4572, 34260, 290328, 2751480, 28686024, 328764732, 4106158164, 55495145304, 806797105320, 12554890849992, 208164423163908, 3663256621120548, 68188490015132040, 1338490745511631080, 27630826605742438968, 598383049497841208340, 13564486434215852731596, 321206759087756505407112, 7930808120217133293871320, 203827200974194835222910072, 5444244452015036032800292860, 150908761972964359914459086268, 4335201280585631579622831206136, 128907976542197708362990931413080, 3962969143175717198269628603237160, 125822954399849744759551544104649004, 4121500248053794328576954126189460996, 139152908806203562724085513268973635128, 4838166452787943228820403108513952093320, 173082662974875462836430760051730458835496, 6365961062477165958220933567040993022424116, 240538410153315660055295309245168998810182100, 9330497878166650152929008135579100419266723816, 371305263476533843716598743128161412641849012680] --------------------------------- This took, 157.241, seconds.