login
A300307
Number of solutions to 1 +- 3 +- 6 +- ... +- n*(n+1)/2 == 0 mod n.
4
1, 2, 0, 4, 4, 16, 12, 32, 20, 112, 88, 384, 308, 1264, 1056, 4096, 3852, 15120, 13820, 52608, 49824, 190848, 182356, 704512, 671540, 2582128, 2475220, 9615744, 9256428, 35868672, 34636840, 134217728, 130021392, 505292976, 491156304, 1909836416, 1857282536
OFFSET
1,2
LINKS
FORMULA
a(2^n) = 2^A000325(n) for n>0 (conjectured).
EXAMPLE
Solutions for n = 7:
------------------------------
1 +3 +6 +10 +15 +21 +28 = 84.
1 +3 +6 +10 +15 +21 -28 = 28.
1 +3 +6 +10 +15 -21 +28 = 42.
1 +3 +6 +10 +15 -21 -28 = -14.
1 +3 -6 +10 -15 +21 +28 = 42.
1 +3 -6 +10 -15 +21 -28 = -14.
1 +3 -6 +10 -15 -21 +28 = 0.
1 +3 -6 +10 -15 -21 -28 = -56.
1 -3 +6 -10 -15 +21 +28 = 28.
1 -3 +6 -10 -15 +21 -28 = -28.
1 -3 +6 -10 -15 -21 +28 = -14.
1 -3 +6 -10 -15 -21 -28 = -70.
PROG
(Ruby)
def A(n)
ary = [1] + Array.new(n - 1, 0)
(1..n).each{|i|
it = i * (i + 1)
a = ary.clone
(0..n - 1).each{|j| a[(j + it) % n] += ary[j]}
ary = a
}
ary[(n * (n + 1) * (n + 2) / 6) % n] / 2
end
def A300307(n)
(1..n).map{|i| A(i)}
end
p A300307(100)
CROSSREFS
KEYWORD
nonn
AUTHOR
Seiichi Manyama, Mar 02 2018
STATUS
approved