A300218 Number of solutions to 1 +- 3 +- 5 +- ... +- (2*n-1) == 0 mod n.
1, 2, 2, 4, 4, 12, 10, 36, 30, 104, 94, 344, 316, 1172, 1096, 4132, 3856, 14572, 13798, 52432, 49940, 190652, 182362, 699416, 671092, 2581112, 2485534, 9586984, 9256396, 35791472, 34636834, 134221860, 130150588, 505290272, 490853416, 1908874584, 1857283156
Offset: 1
Keywords
Examples
Solutions for n = 7: ---------------------------- 1 +3 +5 +7 +9 +11 +13 = 49. 1 +3 +5 -7 +9 +11 +13 = 35. 1 +3 -5 +7 -9 +11 +13 = 21. 1 +3 -5 -7 -9 +11 +13 = 7. 1 -3 +5 +7 +9 -11 +13 = 21. 1 -3 +5 -7 +9 -11 +13 = 7. 1 -3 -5 +7 +9 +11 -13 = 7. 1 -3 -5 +7 -9 -11 +13 = -7. 1 -3 -5 -7 +9 +11 -13 = -7. 1 -3 -5 -7 -9 -11 +13 = -21.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..1000 (first 200 terms from Seiichi Manyama)
Programs
-
Maple
b:= proc(n, i, m) option remember; `if`(i<1, `if`(n=0, 1, 0), add(b(irem(n+j, m), i-2, m), j=[i, m-i])) end: a:= n-> b(n-1, 2*n-3, n): seq(a(n), n=1..40); # Alois P. Heinz, Mar 01 2018
-
Mathematica
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 *)