login
A376646
Number of solutions to x + y == x^2 + y^2 (mod n) with x <= y.
2
1, 3, 3, 6, 3, 10, 5, 10, 7, 10, 7, 20, 7, 18, 10, 18, 9, 26, 11, 20, 18, 26, 13, 36, 11, 26, 19, 36, 15, 36, 17, 34, 26, 34, 18, 52, 19, 42, 26, 36, 21, 68, 23, 52, 26, 50, 25, 68, 29, 42, 34, 52, 27, 74, 26, 68, 42, 58, 31, 72, 31, 66, 50, 66, 26, 100, 35, 68, 50, 68
OFFSET
1,2
LINKS
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
Sequence in context: A196439 A184389 A163163 * A323349 A307982 A339335
KEYWORD
nonn,look
AUTHOR
W. Edwin Clark, Sep 30 2024
STATUS
approved