login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number of solutions to 1 +- 3 +- 6 +- ... +- n*(n+1)/2 == 0 mod n.
4

%I #28 Mar 05 2018 05:02:36

%S 1,2,0,4,4,16,12,32,20,112,88,384,308,1264,1056,4096,3852,15120,13820,

%T 52608,49824,190848,182356,704512,671540,2582128,2475220,9615744,

%U 9256428,35868672,34636840,134217728,130021392,505292976,491156304,1909836416,1857282536

%N Number of solutions to 1 +- 3 +- 6 +- ... +- n*(n+1)/2 == 0 mod n.

%H Seiichi Manyama, <a href="/A300307/b300307.txt">Table of n, a(n) for n = 1..2^11</a>

%F a(2^n) = 2^A000325(n) for n>0 (conjectured).

%e Solutions for n = 7:

%e ------------------------------

%e 1 +3 +6 +10 +15 +21 +28 = 84.

%e 1 +3 +6 +10 +15 +21 -28 = 28.

%e 1 +3 +6 +10 +15 -21 +28 = 42.

%e 1 +3 +6 +10 +15 -21 -28 = -14.

%e 1 +3 -6 +10 -15 +21 +28 = 42.

%e 1 +3 -6 +10 -15 +21 -28 = -14.

%e 1 +3 -6 +10 -15 -21 +28 = 0.

%e 1 +3 -6 +10 -15 -21 -28 = -56.

%e 1 -3 +6 -10 -15 +21 +28 = 28.

%e 1 -3 +6 -10 -15 +21 -28 = -28.

%e 1 -3 +6 -10 -15 -21 +28 = -14.

%e 1 -3 +6 -10 -15 -21 -28 = -70.

%o (Ruby)

%o def A(n)

%o ary = [1] + Array.new(n - 1, 0)

%o (1..n).each{|i|

%o it = i * (i + 1)

%o a = ary.clone

%o (0..n - 1).each{|j| a[(j + it) % n] += ary[j]}

%o ary = a

%o }

%o ary[(n * (n + 1) * (n + 2) / 6) % n] / 2

%o end

%o def A300307(n)

%o (1..n).map{|i| A(i)}

%o end

%o p A300307(100)

%Y Cf. A000079, A000217, A000325, A058498, A300190, A300218.

%K nonn

%O 1,2

%A _Seiichi Manyama_, Mar 02 2018