OFFSET
1,1
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,-1,0,1,-2,1).
FORMULA
For p>0, 0<=q<4, a(4*p+q) = 4*p^2 + 2*p*q (+4 if q=3, +2 otherwise).
a(n) = (13-(-1)^n+2*(-i)^n+2*i^n+2*n^2)/8, where i=sqrt(-1). G.f.: x*(x^7-2*x^6-x^5+2*x^4-x^3+x-2)/((x-1)^3*(x+1)*(x^2+1)). [Colin Barker, Oct 04 2012]
EXAMPLE
0: (0,0)
1: (1,0), (0,1)
2: (2,0), (1,1), (0,2)
3: (3,0), (3,2), (2,3), (0,3)
4: (4,4), (2,2), (0,4), (4,2), (2,4), (4,0)
5: (5,4), (5,0), (4,5), (5,2), (0,5), (4,3), (2,5), (3,4)
In the binary necklace 01010, four beads are next to a zero and three are next to a one, yielding the pair (4,3).
MAPLE
A217123 := proc(n)
local p, q ;
if n < 4 then
return op(n, [2, 3, 4]) ;
end if;
q := n mod 4 ;
p := floor(n/4) ;
if q =3 then
4*p^2+2*p*q +4;
else
4*p^2+2*p*q +2;
end if;
end proc: # R. J. Mathar, Sep 27 2012
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Andrew Woods, Sep 26 2012
STATUS
approved