cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A307269 Number of permutations p of [n] such that |p(i) - p(i-1)| is in {2,5} for all i from 2 to n.

This page as a plain text file.
%I A307269 #21 Oct 23 2021 22:53:11
%S A307269 1,1,0,0,0,0,2,14,12,8,28,58,44,120,254,226,344,932,1262,1380,2958,
%T A307269 5006,5632,9496,18204,23756,32758,59992,90494,118740,196318,320814,
%U A307269 437270,653770,1077580,1570054,2233920,3551168,5426452,7714408,11709864
%N A307269 Number of permutations p of [n] such that |p(i) - p(i-1)| is in {2,5} for all i from 2 to n.
%C A307269 For n>1, a(n)/2 is the number of Hamiltonian paths on the graph with vertex set {1,...,n} where i is adjacent to j iff |i-j| is in {2,5}.
%e A307269 a(6) = 2: 246135, 531642.
%e A307269 a(7) = 14: 1357246, 1642753, 2461357, 2753164, 3164275, 3572461, 4275316, 4613572, 5316427, 5724613, 6135724, 6427531, 7246135, 7531642.
%e A307269 a(8) = 12: 13572468, 13864275, 16427538, 16835724, 42753168, 42753861, 57246138, 57246831, 83164275, 83572461, 86135724, 86427531.
%e A307269 a(9) = 8: 168357249, 168357942, 249753168, 249753861, 861357249, 861357942, 942753168, 942753861.
%p A307269 b:= proc(s, l) option remember; `if`(s={}, 1, add(
%p A307269       `if`(abs(l-j) in {2, 5}, b(s minus {j}, j), 0), j=s))
%p A307269     end:
%p A307269 a:= proc(n) option remember; if n=0 then 1 else
%p A307269       add(b({$1..n} minus {j}, j), j=1..n) fi
%p A307269     end:
%p A307269 seq(a(n), n=0..20);
%t A307269 b[s_, l_] := b[s, l] = If[s == {}, 1, Sum[If[MemberQ[{2, 5}, Abs[l - j]], b[s ~Complement~ {j}, j], 0], {j, s}]];
%t A307269 a[n_] := a[n] = If[n==0, 1, Sum[b[Range[n] ~Complement~ {j}, j], {j, n}]];
%t A307269 Table[Print[n, " ", a[n]]; a[n], {n, 0, 27}] (* _Jean-François Alcover_, Oct 23 2021, after _Alois P. Heinz_ *)
%Y A307269 Cf. A174703, A302118, A328648.
%K A307269 nonn
%O A307269 0,7
%A A307269 _Alois P. Heinz_, Apr 01 2019