OFFSET
1,2
COMMENTS
Superseeker suggests the g.f. ((x^4)+1)/(x^4-2x+1). If the sequences X, in the enumeration of a(n), are required to contain n then sequence A000073 (tribonacci numbers) is obtained.
FORMULA
a(1) = 1, a(n) = term (4,2) in the 4 X 4 matrix [1,1,0,0; 1,0,1,0; 1,0,0,0; 2,0,0,1]^n (n > 1). - Alois P. Heinz, Jul 24 2008
EXAMPLE
a(4) = 4, since the allowable sequences are {1,2,3,4}, {1,2,4,3}, {1,3,2,4} and {1,3,4,2}, whereas {1,4,2,3} and {1,4,3,2} violate the spacing condition.
MAPLE
a:= n-> `if`(n=1, 1, (<<1|1|0|0>, <1|0|1|0>, <1|0|0|0>, <2|0|0|1>>^n)[4, 2]):
seq(a(n), n=1..50); # Alois P. Heinz, Jul 24 2008
MATHEMATICA
a=b=c=0; Join[{1}, Table[d=a+b+c+2; a=b; b=c; c=d, {n, 50}]] (* Vladimir Joseph Stephan Orlovsky, Apr 19 2011 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
John W. Layman, Apr 18 2000
STATUS
approved