login
a(n) is the sum of the residues of the first k positive triangular numbers modulo n, where k = n if n is odd, 2n if n is even.
0

%I #8 Feb 22 2020 22:25:08

%S 0,2,1,12,5,22,14,56,21,70,44,116,52,154,65,240,102,246,133,340,133,

%T 418,230,520,225,546,252,700,348,710,403,992,374,986,455,1140,555,

%U 1254,598,1480,697,1414,774,1804,690,1978,987,2192,980,2150,1037,2444,1219,2466

%N a(n) is the sum of the residues of the first k positive triangular numbers modulo n, where k = n if n is odd, 2n if n is even.

%e For n=4 the first 8 positive triangular numbers are {1,3,6,10,15,21,28,36} == {1,3,2,2,3,1,0,0} (mod 4); the sum of the residues is 12, so a(4)=12.

%e For n=5 the first 5 positive triangular numbers are {1,3,6,10,15} == {1,3,1,0,0} (mod 5); the sum of the residues is 5, so a(5)=5.

%t Riffle[Table[

%t Total[Table[

%t Mod[Table[(n (n + 1)/2), {n, 1, (2 y - 1)}], (2 y - 1)]]], {y, 1,

%t t}] , Table[

%t Total[Table[Mod[Table[(n (n + 1)/2), {n, 1, (4 l)}], (2 l)]]], {l,

%t 1, t}]]

%K nonn

%O 1,2

%A _Tolga Kurt_, Feb 22 2020