OFFSET
1,3
COMMENTS
A necklace composition of n is a finite sequence of positive integers summing to n that is lexicographically minimal among all of its cyclic rotations.
A circular subinterval is a sequence of consecutive indices where the first and last indices are also considered consecutive.
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..80
EXAMPLE
The a(1) = 1 through a(10) = 9 necklace compositions (A = 10):
(1) (2) (3) (4) (5) (6) (7) (8) (9) (A)
(12) (13) (14) (15) (16) (17) (18) (19)
(23) (24) (25) (26) (27) (28)
(34) (35) (36) (37)
(124) (125) (45) (46)
(142) (152) (126) (127)
(135) (136)
(153) (163)
(162) (172)
(234)
(243)
MATHEMATICA
neckQ[q_]:=Array[OrderedQ[{q, RotateRight[q, #]}]&, Length[q]-1, 1, And];
suball[q_]:=Join[Take[q, #]&/@Select[Tuples[Range[Length[q]], 2], OrderedQ], Drop[q, #]&/@Select[Tuples[Range[2, Length[q]-1], 2], OrderedQ]];
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], neckQ[#]&&UnsameQ@@Total/@suball[#]&]], {n, 15}]
PROG
(PARI)
a(n)={
my(recurse(k, r, b, w)=
if(k >= n, 1/r,
b+=1<<k;
my(t=bitand((1<<n)-1, bitor(b<<k, b<<(k-n))));
if(k, self()(k+1, r, b-(1<<k), w)) +
if(!bitand(w, t), self()(k+1, r+1, b, w + t));
));
recurse(0, 0, 0, 0);
} \\ Andrew Howroyd, Mar 25 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, May 13 2019
EXTENSIONS
a(21) onwards from Andrew Howroyd, Mar 24 2025
STATUS
approved
