| Bill Allombert on Wed, 19 Nov 2025 21:24:11 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: question on class number for a certain n |
On Wed, Nov 19, 2025 at 10:16:28AM +0100, Bill Allombert wrote: > On Tue, Nov 18, 2025 at 10:59:53PM -0800, American Citizen wrote: > > Hi all: > > > > I have been looking at representations of integers as the sum of 3 squares > > and things are very interesting. > > > > A quote from Wolfram Math states > > > > > The number of solutions of > > > > > > (36) x^2 + y^2 + z^2 = n > > > > > > for a given n without restriction on the signs or relative sizes of x, > > > y, and z is given by r_3(n). Gauss proved that if n is squarefree and > > > n>4, then > > > > > > (37) r_3(n) = 24h(-n) for n=3 (mod 8); > > > = 12h(-4n) for n=1,2,5,6 (mod 8); > > > = 0 for n=7 (mod 8) > > > > > > (Arno 1992), where h(x) is the class number of x. > > subsequent post. Can r_3(n) be found? > > This is a classical formula, but beware, it count all ordered triples (x,y,z) > in Z^3, so for example for n=17 there are 48 solutions instead of 2. I have found a formula (also for n>4 squarefree) that only count positive increasing triples 0<=a<=b<=c. The idea is to count 'exceptional' representations separately, that is the representations that include repeated terms or the number 0, and use linear algebra. ? cnt(416666) %2 = 339 Cheers, Bill
h(d)=quadclassunit(d).no;
r_3(n) =
{
if(n==1 || n==4,return(6),n==3,return(8));
my(m=n%8);
while(m==0,n=n/4;m=n%8);
if (m==7, 0,
m==3, 24*h(-n),
12*h(-4*n));
}
r_2(n) =
{
my(F=factor(n));
prod(i=1,#F~, if(F[i,1]==2,1,F[i,1]%4==1,F[i,2]+1,F[i,2]%2==0,1,0));
}
r_2d(n) =
{
my(F=factor(n));
prod(i=1,#F~, if(F[i,1]==2,1,F[i,1]%8==1 || F[i,1]%8==3,F[i,2]+1,F[i,2]%2==0,1,0));
}
br(N)=
{
my(c=0, M = sqrtint(N));
forvec(v=[[0,M],[0,M],[0,M]],if(norml2(v)==N,c++),1);
c;
}
cnt(N)=
{
my(a = r_3(N));
my(b = r_2(N));
my(c = r_2d(N));
my(d = issquare(N));
my(e = N%2==0 && issquare(N/2));
return((a+12*(b+c+2*d+2*e))/48);
}