login
Number of solutions to 1 +- 3 +- 5 +- ... +- (2*n-1) == 0 mod n.
2

%I #24 Mar 01 2018 20:23:28

%S 1,2,2,4,4,12,10,36,30,104,94,344,316,1172,1096,4132,3856,14572,13798,

%T 52432,49940,190652,182362,699416,671092,2581112,2485534,9586984,

%U 9256396,35791472,34636834,134221860,130150588,505290272,490853416,1908874584,1857283156

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

%H Alois P. Heinz, <a href="/A300218/b300218.txt">Table of n, a(n) for n = 1..1000</a> (first 200 terms from Seiichi Manyama)

%e Solutions for n = 7:

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

%e 1 +3 +5 +7 +9 +11 +13 = 49.

%e 1 +3 +5 -7 +9 +11 +13 = 35.

%e 1 +3 -5 +7 -9 +11 +13 = 21.

%e 1 +3 -5 -7 -9 +11 +13 = 7.

%e 1 -3 +5 +7 +9 -11 +13 = 21.

%e 1 -3 +5 -7 +9 -11 +13 = 7.

%e 1 -3 -5 +7 +9 +11 -13 = 7.

%e 1 -3 -5 +7 -9 -11 +13 = -7.

%e 1 -3 -5 -7 +9 +11 -13 = -7.

%e 1 -3 -5 -7 -9 -11 +13 = -21.

%p b:= proc(n, i, m) option remember; `if`(i<1, `if`(n=0, 1, 0),

%p add(b(irem(n+j, m), i-2, m), j=[i, m-i]))

%p end:

%p a:= n-> b(n-1, 2*n-3, n):

%p seq(a(n), n=1..40); # _Alois P. Heinz_, Mar 01 2018

%t Table[With[{s = Range[1, (2 n - 1), 2]}, Count[Map[Total[s #] &, Take[Tuples[{-1, 1}, Length@ s], -2^(n - 1)]], _?(Divisible[#, n] &)]], {n, 22}] (* _Michael De Vlieger_, Mar 01 2018 *)

%Y Cf. A063776, A156700, A300190.

%K nonn

%O 1,2

%A _Seiichi Manyama_, Feb 28 2018