OFFSET
1,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..4000
MAPLE
a:=proc(n)
local x, y, count;
count:=0:
for x from 0 to n-1 do
for y from x to n-1 do
if (x+y) mod n =(x^2+y^2) mod n then count:=count+1; fi;
od:
od:
count;
end:
# second Maple program:
a:= n-> add(add(`if`(x^2-x+y^2-y mod n=0, 1, 0), x=0..y), y=0..n-1):
seq(a(n), n=1..70); # Alois P. Heinz, Oct 01 2024
PROG
(PARI) a(n) = sum(y=0, n-1, sum(x=0, y, (x+y) % n == (x^2+y^2) % n)); \\ Michel Marcus, Oct 01 2024
(Python)
def A376646(n):
c = 0
for x in range(n):
m = x*(1-x)%n
c += sum(1 for y in range(x, n) if y*(y-1)%n==m)
return c # Chai Wah Wu, Oct 02 2024
CROSSREFS
KEYWORD
nonn,look
AUTHOR
W. Edwin Clark, Sep 30 2024
STATUS
approved