|
|
A015818
|
|
Number of solutions of +- 1 +- 2 +- ... +- (n-1) +- n = 0 in which the partial sums +- 1 +- ... +- k (1<=k<=n) are all distinct.
|
|
2
|
|
|
1, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 10, 14, 0, 0, 36, 40, 0, 0, 134, 258, 0, 0, 702, 1040, 0, 0, 4170, 5996, 0, 0, 23642, 36616, 0, 0, 140500, 217002, 0, 0, 852132, 1374692, 0, 0, 5411800, 8852230, 0, 0, 35764246, 56370054, 0, 0, 232969442, 376479130, 0, 0, 1555855594, 2534308444
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
COMMENTS
|
If n==1 or 2 (mod 4) then a(n)=0.
|
|
LINKS
|
|
|
EXAMPLE
|
For n=4 there are 2 solutions: +1-2-3+4=0 and -1+2+3-4=0.
|
|
PROG
|
(PARI) issol(i, n) = {b = binary(i); while(length(b) < n, b = concat(0, b)); if (! sum(k=1, n, if (b[k], k, -k)), vsp = []; lastnb = 0; for (j=1, n, vsp = Set(concat(vsp, sum(k=1, j, if (b[k], k, -k)))); if (#vsp == lastnb, return (0)); lastnb = #vsp; ); return (1); ); }
a(n) = if ((!n) || ((n % 4) != 1) && ((n % 4) != 2), sum(i=0, 2^n-1, issol(i, n))); \\ Michel Marcus, May 22 2014
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|