The first, 50, terms of the sequence enumerating permutations of length n suc\ h that |pi[i+3]-pi[i]| is never 3 are [1, 2, 6, 20, 80, 384, 2240, 15424, 123456, 1110928, 11287232, 127016304, 1565107248, 20935873872, 301974271248, 4669727780624, 77046043259824, 1350585114106416, 25062108668100208, 490725684463001488, 10109820295907492304, 218584873235926445712, 4948433337202579395696, 117052159699521707890992, 2887549945416110999938672, 74158795581965682470686352, 1979635478643025761775312848, 54847606543679146894975981328, 1575028667838499959325329451376, 46819703912445220921650905524656, 1439022158114907048820157460269040, 45680235204735305019567567278045712, 1496116661440336048159358675701563984, 50508096602387366765858054108478359696, 1755991517373557783160355643490216142576, 62817435104627278286695442140085522233392, 2310393334469495053193974394036356136433520, 87299233347768896552772128855653699360022416, 3386431349201554860112752783257031947873664720, 134767855873390905654617238350563601806593271824, 5498730800074949336904317410802619706741457848944, 229881755127957528002789990001492791998364633356464, 9841451457388210943977866427713694160142278999425264, 431206278279340148821646053176072682940275730571692816, 19326448949759494318397584681566168932834925382442256720, 885605469018516375131989178812720346128191227873844020624, 41470531824950585962802713919896500365937131106641262778352, 1983576304889813764704917272710339491779588806529800013579056, 96866941597449031028212200415378351127636725214335756138708080, 4827640891382726407226670382902872247799942965340448993234543760] ------------------------ This took , 1470.655, second