mathe 发表于 2025-10-10 15:27:29

O. Fraser and B. Gordon, On representing a square as the sum of three squares, Amer. Math. Monthly, 76 (1969), 922-923.
这篇文章有人能找到吗?

lsr314 发表于 2025-10-10 15:42:08

找到一个文献On the Number of Representations of the Square of an Integer as the Sum of Three Squares

lsr314 发表于 2025-10-10 16:53:06

一个类似的问题: A375335 :a(n) is the smallest positive integer whose square can be represented as the sum of n distinct nonzero squares in exactly n ways, or -1 if no such integer exists.

前几项是1, 1, 25, 23, 17. 目前a(5)还未知,即找一个整数n,使$n^2$恰好有5种方式表示为5个互不相同的正整数的平方和。

f := Length, (FreeQ[#, 0] && # == Union[#]) &]]

前100项是0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 4, 3, 6, 7, 13, 7, 16, 14, 21, 21, 27, 24, 31, 35, 43, 43, 60, 51, 66, 61, 88, 83, 105, 91, 137, 116, 124, 140, 185, 143, 195, 187, 233, 197, 266, 220, 317, 283, 318, 317, 371, 331, 433, 404, 476, 450, 529, 427, 620, 543, 616, 612, 735, 611, 742, 735, 864, 803, 954, 783, 1080, 905, 1053, 1038, 1269, 1038, 1314, 1222, 1331, 1265, 1545, 1309, 1733, 1521, 1615, 1553, 1951, 1607, 2037, 1834, 2145, 2001, 2216, 1959, 2538

看这个数列的增长速度,似乎也是不存在。

mathe 发表于 2025-10-10 16:59:27

现在根据前面的估计公式,只需要计算到300,000项,就可以确保10000项以内没有找到的都是无解了,由此我们可以提交到A374805中了
(16:15) gp > solve(x=10,10^20,x/8-2*x^0.75-10000)
%23 = 268974.60060487191995397568614516513661

代码很简单
#include <vector>
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <gmpxx.h>
#include <map>
#include <vector>
#include <numeric>
#include <algorithm>


#define LUP 300000L
#define LUB 10000
char *notprime;
int *qlist;
int *lp;
int qc;
long c;

#define ISPRIME(x) (!notprime)
#define UNSETPRIME(x) (notprime=1)

struct PF{
   int pi;
   int pc;
   bool operator<(const PF& pf)const{
       if(pi>pf.pi)return true;//sort in reverse order
       if(pi<pf.pi)return false;
       return pc<pf.pc;
   }
};

struct PData{
    int x,y;
};

std::vector<PF> factors;
typedef std::map<long, std::vector<PData> > PMAP;
#define LIMIT 5

void mergefactors(std::vector<PF>& pf1, const std::vector<PF>& pf2)
{
    std::vector<PF> out;
    int i,j;
    for(i=0,j=0;i<pf1.size()&&j<pf2.size();){
        if(pf1.pi==pf2.pi){
          PF y;
          y.pi=pf1.pi;
          y.pc=pf1.pc+pf2.pc;
          out.push_back(y);
          i++;j++;
        }else if(pf1.pi>pf2.pi){
          out.push_back(pf1);
          i++;
        }else{
          out.push_back(pf2);
          j++;
        }
    }
    for(;i<pf1.size();i++){
          out.push_back(pf1);
    }
    for(;j<pf2.size();j++){
          out.push_back(pf2);
    }
    pf1=out;
}

void getfactors(long x, std::vector<PF>& pf)
{
    int pc=0;
    int curp=-1;
    if(x==0)return;
    while(lp>=0){
        if(lp==curp){
          pc++;
        }else{
          if(curp>=0){
                   PF y;
                   y.pi=curp;
                   y.pc=pc;
                   pf.push_back(y);
          }
          pc=1;
          curp=lp;
        }
        x/=qlist];
    }
    if(pc>0){
        PF y;
        y.pi=curp;
        y.pc=pc;
        pf.push_back(y);
    }
}


void initprime()
{
    qlist=(int *)malloc(2*LUP*sizeof(int));
    lp=(int *)malloc(2*LUP*sizeof(int));
    notprime=(char *)malloc(2*LUP*sizeof(char));
    memset(notprime,0,2*LUP*sizeof(char));
    UNSETPRIME(0);
    UNSETPRIME(1);
    long i,j;
    for(i=2;i<2*LUP;i++){
        if(!ISPRIME(i))continue;
        {
          qlist=i;
        }
        for(j=i*i;j<2*LUP;j+=i){
          UNSETPRIME(j);
        }
    }
    for(i=0;i<2*LUP;i++)lp=-1;
    for(i=0;i<qc;i++){
        for(j=qlist;j<2*LUP;j+=qlist){
          lp=i;
        }
    }
    for(i=2;i<2*LUP;i++){
        getfactors(i,factors);
    }
}

long getsc(long c, long d)
{
    int i;
    bool is_sqr=1;
    std::vector<PF> pf1, pf2;
    pf1=factors;
    mergefactors(pf1,factors);
    long r=1;
    for(i=0;i<pf1.size();i++){
        long p=qlist.pi];
        if((pf1.pc&1)==1)is_sqr=0;
        if(p%4==3&&(pf1.pc&1)==1)return 0;
        if(p%4==1){
                r*=pf1.pc+1;
        }
    }
    if(is_sqr)r--;
    return r;
}

long gete2(long x, long y)
{
        std::vector<PF> p1=factors;
        std::vector<PF>& p2=factors;
        mergefactors(p1,p2);
        long prod=1;
        for(int i=0;i<p1.size();i++){
                long pm=qlist.pi];
                if((pm&1)==0)continue;
                if(pm%4==3){
                        if(p1.pc&1)return 0;
                }else{
                        prod*=p1.pc+1;
                }
        }
        return prod;
}

long gete(long x)
{
        std::vector<PF>& fac=factors;
        long prod=1;
        for(int i=0;i<fac.size();i++){
                long pm = qlist.pi];
                if((pm&1)==0)continue;
                if(pm%4==3){
                        if(fac.pc&1)return 0;
                }else{
                        prod*=fac.pc+1;
                }
        }
        return prod;
}

std::map<long ,long > rmap;

long getr(long d)
{
        std::vector<PF>& fac=factors;
        long prod=1;
        int i;
        for(i=0;i<fac.size();i++){
                long p=qlist.pi];
                if((p&1)==0)continue;
                int h;
                long pm=1;
                for(h=0;h<fac.pc;h++)pm*=p;
                if(p%4==3){
                        prod*=pm+2*(pm-1)/(p-1);
                }else{
                        prod*=pm;
                }
        }
        return prod;
}

long gets(long d)
{
        std::vector<PF>& fac=factors;
        long prod=1;
        for(int i=0;i<fac.size();i++){
                long p=qlist.pi];
                int m=p%8;
                if(m!=1&&m!=3)continue;
                prod*=2*fac.pc+1;
        }
        return prod;
}

long gett(long d)
{
        std::vector<PF>& fac=factors;
        long prod=1;
        for(int i=0;i<fac.size();i++){
                long p=qlist.pi];
                int m=p%4;
                if(m!=1)continue;
                prod*=2*fac.pc+1;
        }
        return prod;
}

int main()
{
    long d;
    initprime();
    memset(c,-1,sizeof(c));
    for(d=1;d<LUP;d+=2){
        long r=getr(d);
        long s=gets(d);
        long t=gett(d);
        long f=(r-2*s-2*t+3)/8;
        if(f<LUB&&c<0){
                c=d;
        }
    }
    for(d=1;d<LUB;d++){
          printf("%ld %ld\n",d,c);
    }
    return 0;
}

wayne 发表于 2025-10-10 18:29:02

mathe 发表于 2025-10-10 15:27
O. Fraser and B. Gordon, On representing a square as the sum of three squares, Amer. Math. Monthly,...

下载下来了.


northwolves 发表于 2025-10-10 21:30:05

这个公式很强:(a² + b² + c² + d²)² = (a² + b² - c² - d²)² + (2ac + 2bd)² + (2ad - 2bc)²

mathe 发表于 2025-10-11 12:51:16

这个就是欧拉四平方数公式
\((a^2+b^2+c^2+d^2)(x^2+y^2+z^2+w^2)=(ax+by+cz+dw)^2+(ay-bx+cw-dz)^2+(az-bw-cx+dy)^2+(aw+bz-cy-dx)^2\)
其中取\(x=a,y=b,z=-c,w=-d\)
页: 1 2 [3]
查看完整版本: a^2+b^2+c^2=d^2(0<a<b<c<d) 恰好有44组正整数解