login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A174700 The number of permutations p of {1,...,n} such that |p(i)-p(i+1)| is in {1,2,3} for all i from 1 to n-1. 14
1, 1, 2, 6, 24, 72, 180, 428, 1042, 2512, 5912, 13592, 30872, 69560, 155568, 345282, 761312, 1669612, 3645236, 7927404, 17180092, 37119040, 79986902, 171964534, 368959906, 790214816, 1689779842, 3608413750, 7696189046 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

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 {1,2,3}.

LINKS

Andrew Howroyd, Table of n, a(n) for n = 0..100

FORMULA

Empirical: a(n) = 3*a(n-1) - 4*a(n-3) + 3*a(n-4) - 4*a(n-5) - 9*a(n-6) + 2*a(n-7) + 5*a(n-8) + 9*a(n-9) + 17*a(n-10) + 16*a(n-11) + 14*a(n-12) + 8*a(n-13) - 2*a(n-14) - 5*a(n-15) - 5*a(n-16) - 6*a(n-17) - 4*a(n-18) - a(n-19) for n > 20. - Andrew Howroyd, Apr 08 2016

Empirical G.f.: (-3+x) + (2*(2-6*x+x^2+8*x^3-3*x^4+12*x^5 +9*x^6-17*x^7 -2*x^8-19*x^10 -26*x^11 -29*x^12-13*x^13+9*x^14+7*x^15 +4*x^16+6*x^17 +3*x^18)) / ((1+x)*(-1+x+x^2 +x^4+x^5)^2*(1-2*x+x^2-2*x^3-x^4-x^5 +x^7 +x^8)). - Andrew Howroyd, Apr 08 2016

MAPLE

f:= proc(m, M, n) option remember; local i, l, p, cnt; l:= array([i$i=1..n]); cnt:=0; p:= proc(t) local d, j, h; if t=n then d:=`if`(t=1, m, abs(l[t]-l[t-1])); if m<=d and d<=M then cnt:= cnt+1 fi else for j from t to n do l[t], l[j]:= l[j], l[t]; d:=`if`(t=1, m, abs(l[t]-l[t-1])); if m<=d and d<=M then p(t+1) fi od; h:= l[t]; for j from t to n-1 do l[j]:= l[j+1] od; l[n]:= h fi end; p(1); cnt end: a:=n->f(1, 3, n); # Alois P. Heinz, Mar 27 2010

MATHEMATICA

f[m_, M_, n_] := f[m, M, n] = Module[{i, l, p, cnt}, Do[l[i] = i, {i, 1, n}]; cnt = 0; p[t_] := Module[{d, j, h}, If[t == n, d = If[t == 1, m, Abs[l[t] - l[t-1]]]; If [m <= d && d <= M, cnt = cnt+1], For[j = t, j <= n, j++, {l[t], l[j]} = {l[j], l[t]}; d = If[t == 1, m, Abs[l[t] - l[t-1]]]; If [m <= d && d <= M, p[t+1]]]; h = l[t]; For[j = t, j <= n-1, j++, l[j] = l[j+1]]; l[n] = h]]; p[1]; cnt]; a[n_] := f[1, 3, n]; Table[Print["a(", n, ") = ", a[n]]; a[n], {n, 1, 15}] (* slow beyond n = 15 *) (* Jean-Fran├žois Alcover, Jun 01 2015, after Alois P. Heinz *)

CROSSREFS

Cf. A003274, A174701, A174702, A174703, A174704, A174705, A174706, A174707, A174708, A185030, A216837.

Sequence in context: A236625 A096259 A087645 * A216158 A178847 A173844

Adjacent sequences:  A174697 A174698 A174699 * A174701 A174702 A174703

KEYWORD

nonn

AUTHOR

W. Edwin Clark, Mar 27 2010

EXTENSIONS

a(19)-a(28) from R. H. Hardin, May 06 2010

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified August 30 18:47 EDT 2016. Contains 275970 sequences.