OFFSET
1,5
COMMENTS
a(26) and a(27) are both squares. Conjecture: the number of n such that a(n) and a(n+1) are both squares is infinite.
a(p = prime) == 0 (mod p) for p > 3.
MATHEMATICA
Table[Sum[Mod[k^2, n], {k, Floor[n/2]}], {n, 100}] (* T. D. Noe, Oct 22 2013 *)
Table[Sum[PowerMod[k, 2, n], {k, Floor[n/2]}], {n, 100}] (* Harvey P. Dale, Jul 03 2022 *)
PROG
(JavaScript)
for (i=1; i<50; i++) {
c=0;
for (j=1; j<=i/2; j++) c+=(j*j)%i;
document.write(c+", ");
}
(PARI) a(n)=sum(i=1, floor(n/2), (i*i)%n) \\ Ralf Stephan, Oct 19 2013
(Python)
def A230366(n): return sum(k**2%n for k in range(1, (n>>1)+1)) # Chai Wah Wu, Jun 02 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Jon Perry, Oct 17 2013
STATUS
approved