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”).

a(n) = sum_{k=1..(n-1)/2} (k^2 mod n).
3

%I #7 Jan 30 2016 09:21:27

%S 0,0,1,1,5,5,7,6,12,20,22,19,39,35,35,28,68,60,76,65,91,99,92,74,125,

%T 156,144,147,203,175,186,152,242,272,245,201,333,323,286,270,410,392,

%U 430,363,420,437,423,340,490,550,578,585,689,639,605,546,760,812

%N a(n) = sum_{k=1..(n-1)/2} (k^2 mod n).

%C This expression occurred to S. A. Shirali while demonstrating a result concerning A081115 and A228432. This led him to investigate integers n such that a(n) = n*(n-1)/4, a(n) = floor(n/4), or a(n) = n*(n-1)/4 - n.

%H Harvey P. Dale, <a href="/A231589/b231589.txt">Table of n, a(n) for n = 1..1000</a>

%H S. A. Shirali, <a href="http://www.jstor.org/stable/2690862">A family portrait of primes-a case study in discrimination</a>, Math. Mag. Vol. 70, No. 4 (Oct., 1997), pp. 263-272.

%t Table[Sum[PowerMod[k,2,n],{k,(n-1)/2}],{n,60}] (* _Harvey P. Dale_, Jan 30 2016 *)

%o (PARI) a(n) = sum(k=1, (n-1)\2, k^2 % n);

%Y Cf. A048152, A048153.

%K nonn

%O 1,5

%A _Michel Marcus_, Nov 11 2013