login
A111143
Number of different ways of drawing chords in a circle of numbers from 1 to n such that the sums of the numbers on the two sides of the chord are equal.
1
1, 0, 0, 1, 1, 0, 0, 2, 1, 0, 0, 1, 2, 2, 0, 1, 1, 0, 0, 2, 1, 0, 1, 1, 2, 0, 0, 1, 1, 0, 2, 2, 1, 0, 0, 1, 2, 1, 0, 1, 1, 0, 0, 2, 1, 0, 1, 1, 3, 0, 0, 1, 2, 1, 1, 2, 1, 0, 0, 1, 2, 4, 3, 2, 1, 0, 0, 3, 1, 0, 0, 1, 2, 0, 0, 2, 1, 0, 3, 2, 1, 0, 0, 1, 2, 1, 0, 1, 4, 0, 0, 2, 1, 4, 0, 1, 3, 0
OFFSET
2,8
LINKS
EXAMPLE
a(5) = 1 because in a circle with the numbers from 1 to 5 we can put a chord from 1 and 4 and the sum of both sides is the same.
a(9) = 2 as in a circle with the numbers from 1 to 9 we can put a chord in two ways, one from 2 to 7 and another from 6 to 9.
MAPLE
a:= proc(n) local c, i, j, u, v;
c, i, j, u, v:= 0, 1, 2, 0, n*(n+1)/2-3;
while j<=n do
c:= c + `if`(u=v, 1, 0);
if u>v then u, v:= u-i-1, v+i; i:=i+1
else u, v:= u+j, v-j-1; j:=j+1
fi;
od; c
end:
seq(a(n), n=2..100); # Alois P. Heinz, Sep 12 2011
MATHEMATICA
a[n_] := Module[{c = 0, i = 1, j = 2, u = 0, v = n(n+1)/2 - 3}, While[j <= n, c += If[u == v, 1, 0]; If[u > v, {u, v} = {u - i - 1, v + i}; i++, {u, v} = {u + j, v - j - 1}; j++]]; c];
a /@ Range[2, 100] (* Jean-François Alcover, Nov 18 2020, after Alois P. Heinz *)
CROSSREFS
Sequence in context: A137867 A324734 A359902 * A356969 A342955 A004197
KEYWORD
easy,nonn
AUTHOR
Joao B. Oliveira (oliveira(AT)inf.pucrs.br), Oct 18 2005
STATUS
approved