%I #8 Jun 29 2021 16:28:04
%S 1,0,1,1,0,1,1,0,1,1,0,0,1,0,1,2,0,1,0,0,2,1,0,1,1,0,1,1,0,0,1,0,0,1,
%T 0,2,1,0,1,0,0,1,1,0,1,2,0,1,1,0,2,0,0,0,2,0,1,1,0,1,0,0,0,1,0,2,1,0,
%U 1,1,0,1,1,0,0,2,0,1,1,0,2,0,0,1,0,0,1,1,0,0,2,0,1,2,0,0,1,0,1
%N a(n) = number of primitive solutions to 4n+1 = x^2 + y^2.
%C "Primitive" means that x and y are positive and mutually prime.
%H R. J. Mathar, <a href="/A106594/b106594.txt">Table of n, a(n) for n = 1..10000</a>
%e E.g. a(16)=2 because 65 = 8^2+1^2 = 7^2+4^2. a(11)=0 because although 45=6^2+3^2, 6 and 3 are not mutually prime. a(2)=0 because although 9=3^2+0^2, 0 is not positive.
%p A106594 := proc(n)
%p local a,x,y,fourn;
%p fourn := 4*n+1 ;
%p a := 0 ;
%p for x from 1 do
%p if x^2 >= fourn then
%p return a;
%p else
%p y := fourn-x^2 ;
%p if issqr(y) then
%p y := sqrt(y) ;
%p if y <= x and igcd(x,y) = 1 then
%p a := a+1 ;
%p end if;
%p end if;
%p end if;
%p end do:
%p end proc: # _R. J. Mathar_, Sep 21 2013
%t Table[Length[If[CoprimeQ[#[[1]],#[[2]]],#,Nothing]&/@Union[Sort/@ ({#[[1,2]],#[[2,2]]}&/@FindInstance[{4 n+1==x^2+y^2,x>0,y>0},{x,y}, Integers,10])]],{n,100}] (* _Harvey P. Dale_, Jun 29 2021 *)
%Y Cf. A106602, A193138.
%K easy,nonn
%O 1,16
%A _Colin Mallows_, May 10 2005