%I #19 Sep 08 2022 08:45:55
%S 1,0,1,0,4,0,8,0,0,0,12,0,12,0,4,0,16,0,20,0,8,0,24,0,20,0,0,0,28,0,
%T 32,0,12,0,32,0,36,0,12,0,40,0,44,0,0,0,48,0,56,0,16,0,52,0,48,0,20,0,
%U 60,0,60,0,0,0,48,0,68,0,24,0,72,0,72,0,20,0,96,0
%N Number of solutions to x^2 + x + y + y^2 == 1 mod n.
%H Charles R Greathouse IV, <a href="/A182158/b182158.txt">Table of n, a(n) for n = 1..10000</a>
%t a[1]=1;a[n_]:=Length@Rest@Union@Flatten@Table[If[Mod[i^2+i+ j +j^2 ,n]==1,i+I j,0],{i,0,n-1},{j,0,n-1}]; Table[a[n],{n,1,98}]
%o (PARI) a(n)=sum(x=1,n,sum(y=1,n,Mod(x^2+x+y+y^2,n)==1)) \\ _Charles R Greathouse IV_, Apr 16 2012
%o (PARI) A(n)=my(v=vecsort(vector(n,i,i^2+i)%n),u=vecsort(v,,8), w=vector(#u), j=1);w[1]=1;for(i=2,#v,if(v[i]>v[i-1],j++);w[j]++);sum(i=2,#u,while(u[i]+u[j]>n+1,j--);if(u[i]+u[j]==n+1, w[i]*w[j]))+ if(#u>1&&u[2]==1,2*w[1]*w[2])
%o a(n)=n=factor(n);prod(i=1,#n[,1],A(n[i,1]^n[i,2])) \\ _Charles R Greathouse IV_, Apr 16 2012
%o (Magma) [n eq 1 select 1 else #[x: x in [1..n], y in [1..n] | (x^2+x+y+y^2) mod n eq 1]: n in [1..78]]; // _Bruno Berselli_, Apr 16 2012
%K nonn,mult
%O 1,5
%A _José María Grau Ribas_, Apr 15 2012