OFFSET
1,1
COMMENTS
Start with (1,2,3,4), i.e. the first permutation of {1,2,3} followed by 4; then for each next permutation, transpose 4 one to the left; if at position 1, replace {1,2,3} recursively by the next permutation of these numbers. Thereafter, for each next permutation, transpose 4 to the right. And so on.
LINKS
Richard Duckworth and Fabian Stedman, Tintinnalogia, or, the Art of Ringing, (1671). Released by Project Gutenberg, 2006.
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,0,0,0,0,0,0,-1,1).
FORMULA
Period 24.
MAPLE
ring:= proc(k::nonnegint) local p, i, left, l, nf, ini; if k<=1 then proc() [1$k] end else ini := proc() p:= ring(k-1); i:= k; left:= true; l:= p(); nf:= k! end; ini(); proc() local ll; ll:= [seq(l[t], t=1..(i-1)), k, seq(l[t], t=i..(k-1))]; if left then if i>1 then i:= i-1 else left:= false; l:=p() fi else if i<k then i:= i+1 else left:= true; l:=p() fi fi; nf:= nf-1; if nf = 0 then ini() fi; ll end fi end: bell := proc(k) option remember; local p; p:= ring(k); [seq(p(), i=1..k!)] end: indx:= proc(l, k) local i; for i from 1 to nops(l) do if l[i]=k then break fi od; i end: a := n-> indx (bell(4)[modp(n-1, 24)+1], 3): seq (a(n), n=1..121);
MATHEMATICA
a[n_] := a[n] = If[n <= 13, {3, 4, 4, 4, 3, 3, 2, 2, 1, 1, 1, 2, 2}[[n]], a[n-1] - a[n-12] + a[n-13]]; Array[a, 105] (* Jean-François Alcover, May 01 2019 *)
LinearRecurrence[{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1}, {3, 4, 4, 4, 3, 3, 2, 2, 1, 1, 1, 2, 2}, 120] (* Harvey P. Dale, Apr 28 2020 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Alois P. Heinz, Aug 19 2008
STATUS
approved