- 注册时间
- 2008-11-26
- 最后登录
- 1970-1-1
- 威望
- 星
- 金币
- 枚
- 贡献
- 分
- 经验
- 点
- 鲜花
- 朵
- 魅力
- 点
- 上传
- 次
- 下载
- 次
- 积分
- 149507
- 在线时间
- 小时
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?欢迎注册
×
本帖最后由 mathematica 于 2019-3-13 16:31 编辑
很显然解是存在的,剩下的就是写代码的问题了!
- (*把素数表达成四个整数的平方和,程序可能有bug*)
- Clear["Global`*"];(*Clear all variables*)
- (*子函数,根据迭代,输入四个整数,一个素数,得到四个整数,降低四个整数的平方和的大小*)
- fun[xx_,p_]:=Module[{x1,x2,x3,x4,y1,y2,y3,y4,m,u1,u2,u3,u4},
- x1=xx[[1]];
- x2=xx[[2]];
- x3=xx[[3]];
- x4=xx[[4]];
- m=(x1^2+x2^2+x3^2+x4^2)/p;
- If[m==1,Return[xx]];
- (*模m后绝对值不超过m/2*)
- y1=Mod[x1,m];If[y1>m/2,y1=y1-m];
- y2=Mod[x2,m];If[y2>m/2,y2=y2-m];
- y3=Mod[x3,m];If[y3>m/2,y3=y3-m];
- y4=Mod[x4,m];If[y4>m/2,y4=y4-m];
- u1=x1*y1+x2*y2+x3*y3+x4*y4;
- u2=x1*y2-x2*y1+x3*y4-x4*y3;
- u3=x1*y3-x3*y1+x4*y2-x2*y4;
- u4=x1*y4-x4*y1+x2*y3-x3*y2;
- u1=Abs[u1/m];
- u2=Abs[u2/m];
- u3=Abs[u3/m];
- u4=Abs[u4/m];
- Print[{u1,u2,u3,u4,(u1^2+u2^2+u3^2+u4^2)/p}];
- Return[{u1,u2,u3,u4}]
- ]
- p=NextPrime[10^23];(*被表达成四平方和的素数*)
- x2=1;(*初始值*)
- x3=1;
- x4=0;
- (*一定要找到勒让德符号等于1的,这样才能保证找到x1的值*)
- While[JacobiSymbol[-(x2^2+x3^2+x4^2),p]!=1,x2=x2+1];
- x1=PowerMod[-(x2^2+x3^2+x4^2),1/2,p];(*有限域开平方根得到x1的值*)
- If[x1>p/2,x1=p-x1];
- inp={x1,x2,x3,x4};
- While[Total[inp^2]!=p,inp=fun[inp,p]]
复制代码
{2788746277617240794317,6,2,0,77771058009240166637}
{394865994220668595295,216,72,0,1559191533918770845}
{98903462170845390482,54648,18216,0,97818948293798452}
{8599745275310222815,55249128,18416376,0,739556188002205}
{2161938692729107297,642436860384,214145620128,0,46739789111197}
{474232184858022618,29715916977061920,9905305659020640,0,2258773159572}
{101187808261202479,112138741018396488,120697814613208710,9905305659020640,374801473105}
{53114403389536044,8233295348868331,7534650454384885,45043482096771590,49746132366}
{13860512533272035,9638617004223700,11027560405173174,9789878005938350,5024655453}
{2591675315436957,4341372920184228,481874603117950,4823975828516944,490672457}
{2723542341856752,3638553890845146,615354662129160,1880024078389688,245699092}
{582392340938173,2220245268383094,426273512038452,21575504013614,54508445}
{665005506809903,863992044909728,1497280747238039,617229686741905,38115367}
{130539633766375,317393334189096,615342520427249,357150889656893,6239823}
{184572705350540,333038715140273,307244129941609,52359099244759,2421223}
{96469421038424,64955390665857,222487640235921,120679318734440,775898}
{35538833053807,70483726061193,31511638716165,68375085602332,118991}
{52127944064440,29784163746704,2004787993209,10067862862913,37098}
{36676527348765,18345822861400,30754320794154,2633415588868,26345}
{8049488371896,5589046640796,19314117934191,10345682337182,5761}
{5127064237247,11940448524783,6184493916624,5088313701944,2330}
{1883746011250,1902447110777,3864830143676,6260613701254,613}
{832897246917,864132527400,3627566446794,1048960831138,157}
{1461118206527,490990145867,648475205685,896405137663,36}
{232765546049,42313574336,60453717284,200935586858,1}
这个结果告诉我们
\[10^{23}+117=232765546049^2+42313574336^2+60453717284^2+200935586858^2\]
|
|