修改bug:-
- N()=
- {
- 5
- }
-
- K()=
- {
- N()-2
- }
-
- BEGIN()=
- {
- 0
- }
-
- END()=
- {
- -1
- }
-
- OUTFILENAME()=
- {
- "/home/zdu/N5.txt"
- }
-
- output()=
- {
- local(V,MM,RR,uu,f,v,v2,a,b,d);
- MM=M[K()];
- RR=R[K()];
- V=MM;
- c=c+1;
- if(c>=BEGIN()&&(END()<0||c<=END()),
- f=divisors(V);
- for(u=1,length(f),
- for(u2=u,length(f),
- v=f[u];v2=f[u2];
- if((v+v2)%RR!=0, next());
- if(gcd(v,v2)>1,next());
- d=(v+v2)/RR*(V/(v*v2));
- a=d*v;b=d*v2;
- if(a>=n[K()],
- n[K()+1]=a;
- n[K()+2]=b;
- write(OUTFILENAME(),n)
- )
- )
- )
- );
- if(c%100==0, print("process " c " lines"))
- }
-
- search(level)=
- {
- local(ll,uu,dd);
- if(level>=K(),
- output(),
- ll=floor(M[level]/R[level])+1;
- uu=floor((N()-level)*M[level]/R[level]);
- if(ll<=n[level],ll=n[level]);
- for(i=ll,uu,
- n[level+1]=i;
- dd=gcd(M[level],i);
- M[level+1]=M[level]*i/dd;
- R[level+1]=(R[level]*i-M[level])/dd;
- A[i%4+1]=A[i%4+1]+1;
- search(level+1);
- A[i%4+1]=A[i%4+1]-1
- )
- )
- }
-
- search0()=
- {
- n=vector(N());
- M=vector(N());
- R=vector(N());
- A=vector(4);
- c=0;
- for(i=2,8,
- n[1]=i;
- R[1]=i-1;
- M[1]=i;
- A[i%4+1]=A[i%4+1]+1;
- search(1);
- A[i%4+1]=A[i%4+1]-1;
- )
- }
复制代码 N=5的结果很多,有413个-
- [2, 3, 7, 63, 126]
- [2, 3, 7, 56, 168]
- [2, 3, 7, 49, 294]
- [2, 3, 7, 48, 336]
- [2, 3, 7, 45, 630]
- [2, 3, 7, 44, 924]
- [2, 3, 7, 43, 1806]
- [2, 3, 7, 70, 105]
- [2, 3, 7, 54, 189]
- [2, 3, 7, 46, 483]
- [2, 3, 7, 60, 140]
- [2, 3, 7, 51, 238]
- [2, 3, 7, 78, 91]
- [2, 3, 8, 36, 72]
- [2, 3, 8, 32, 96]
- [2, 3, 8, 30, 120]
- [2, 3, 8, 28, 168]
- [2, 3, 8, 27, 216]
- [2, 3, 8, 26, 312]
- [2, 3, 8, 25, 600]
- [2, 3, 8, 40, 60]
- [2, 3, 8, 42, 56]
- [2, 3, 8, 33, 88]
- [2, 3, 9, 27, 54]
- [2, 3, 9, 24, 72]
- [2, 3, 9, 21, 126]
- [2, 3, 9, 20, 180]
- [2, 3, 9, 19, 342]
- [2, 3, 9, 30, 45]
- [2, 3, 9, 22, 99]
- [2, 3, 10, 20, 60]
- [2, 3, 10, 18, 90]
- [2, 3, 10, 16, 240]
- [2, 3, 10, 24, 40]
- [2, 3, 11, 22, 33]
- [2, 3, 11, 14, 231]
- [2, 3, 11, 15, 110]
- [2, 3, 12, 18, 36]
- [2, 3, 12, 16, 48]
- [2, 3, 12, 15, 60]
- [2, 3, 12, 14, 84]
- [2, 3, 12, 13, 156]
- [2, 3, 12, 20, 30]
- [2, 3, 12, 21, 28]
- [2, 4, 5, 30, 60]
- [2, 4, 5, 25, 100]
- [2, 4, 5, 24, 120]
- [2, 4, 5, 22, 220]
- [2, 4, 5, 21, 420]
- [2, 4, 5, 28, 70]
- [2, 4, 5, 36, 45]
- [2, 4, 6, 18, 36]
- [2, 4, 6, 16, 48]
- [2, 4, 6, 15, 60]
- [2, 4, 6, 14, 84]
- [2, 4, 6, 13, 156]
- [2, 4, 6, 20, 30]
- [2, 4, 6, 21, 28]
- [2, 4, 7, 14, 28]
- [2, 4, 7, 10, 140]
- [2, 4, 7, 12, 42]
- [2, 4, 8, 12, 24]
- [2, 4, 8, 10, 40]
- [2, 4, 8, 9, 72]
- [2, 4, 9, 12, 18]
- [2, 4, 10, 12, 15]
- [2, 5, 6, 10, 30]
- [2, 5, 6, 8, 120]
- [2, 5, 6, 12, 20]
- [3, 4, 5, 6, 20]
- [2, 3, 7, 63, 126]
- [2, 3, 7, 56, 168]
- [2, 3, 7, 49, 294]
- [2, 3, 7, 48, 336]
- [2, 3, 7, 45, 630]
- [2, 3, 7, 44, 924]
- [2, 3, 7, 43, 1806]
- [2, 3, 7, 70, 105]
- [2, 3, 7, 54, 189]
- [2, 3, 7, 46, 483]
- [2, 3, 7, 60, 140]
- [2, 3, 7, 51, 238]
- [2, 3, 7, 78, 91]
- [2, 3, 8, 36, 72]
- [2, 3, 8, 32, 96]
- [2, 3, 8, 30, 120]
- [2, 3, 8, 28, 168]
- [2, 3, 8, 27, 216]
- [2, 3, 8, 26, 312]
- [2, 3, 8, 25, 600]
- [2, 3, 8, 40, 60]
- [2, 3, 8, 42, 56]
- [2, 3, 8, 33, 88]
- [2, 3, 9, 27, 54]
- [2, 3, 9, 24, 72]
- [2, 3, 9, 21, 126]
- [2, 3, 9, 20, 180]
- [2, 3, 9, 19, 342]
- [2, 3, 9, 30, 45]
- [2, 3, 9, 22, 99]
- [2, 3, 10, 20, 60]
- [2, 3, 10, 18, 90]
- [2, 3, 10, 16, 240]
- [2, 3, 10, 24, 40]
- [2, 3, 11, 22, 33]
- [2, 3, 11, 14, 231]
- [2, 3, 11, 15, 110]
- [2, 3, 12, 18, 36]
- [2, 3, 12, 16, 48]
- [2, 3, 12, 15, 60]
- [2, 3, 12, 14, 84]
- [2, 3, 12, 13, 156]
- [2, 3, 12, 20, 30]
- [2, 3, 12, 21, 28]
- [2, 4, 5, 30, 60]
- [2, 4, 5, 25, 100]
- [2, 4, 5, 24, 120]
- [2, 4, 5, 22, 220]
- [2, 4, 5, 21, 420]
- [2, 4, 5, 28, 70]
- [2, 4, 5, 36, 45]
- [2, 4, 6, 18, 36]
- [2, 4, 6, 16, 48]
- [2, 4, 6, 15, 60]
- [2, 4, 6, 14, 84]
- [2, 4, 6, 13, 156]
- [2, 4, 6, 20, 30]
- [2, 4, 6, 21, 28]
- [2, 4, 7, 14, 28]
- [2, 4, 7, 10, 140]
- [2, 4, 7, 12, 42]
- [2, 4, 8, 12, 24]
- [2, 4, 8, 10, 40]
- [2, 4, 8, 9, 72]
- [2, 4, 9, 12, 18]
- [2, 4, 10, 12, 15]
- [2, 5, 5, 15, 30]
- [2, 5, 5, 12, 60]
- [2, 5, 5, 11, 110]
- [2, 5, 5, 14, 35]
- [2, 5, 6, 10, 30]
- [2, 5, 6, 8, 120]
- [2, 5, 6, 12, 20]
- [2, 6, 6, 9, 18]
- [2, 6, 6, 8, 24]
- [2, 6, 6, 7, 42]
- [2, 6, 6, 10, 15]
- [3, 3, 4, 18, 36]
- [3, 3, 4, 16, 48]
- [3, 3, 4, 15, 60]
- [3, 3, 4, 14, 84]
- [3, 3, 4, 13, 156]
- [3, 3, 4, 20, 30]
- [3, 3, 4, 21, 28]
- [3, 3, 5, 10, 30]
- [3, 3, 5, 9, 45]
- [3, 3, 5, 8, 120]
- [3, 3, 5, 12, 20]
- [3, 3, 6, 9, 18]
- [3, 3, 6, 8, 24]
- [3, 3, 6, 7, 42]
- [3, 3, 6, 10, 15]
- [3, 4, 4, 8, 24]
- [3, 4, 5, 6, 20]
- [3, 5, 5, 6, 10]
- [4, 4, 4, 6, 12]
- [4, 4, 4, 5, 20]
- [2, 3, 7, 84, 84]
- [2, 3, 7, 63, 126]
- [2, 3, 7, 56, 168]
- [2, 3, 7, 49, 294]
- [2, 3, 7, 48, 336]
- [2, 3, 7, 45, 630]
- [2, 3, 7, 44, 924]
- [2, 3, 7, 43, 1806]
- [2, 3, 7, 70, 105]
- [2, 3, 7, 54, 189]
- [2, 3, 7, 46, 483]
- [2, 3, 7, 60, 140]
- [2, 3, 7, 51, 238]
- [2, 3, 7, 78, 91]
- [2, 3, 8, 48, 48]
- [2, 3, 8, 36, 72]
- [2, 3, 8, 32, 96]
- [2, 3, 8, 30, 120]
- [2, 3, 8, 28, 168]
- [2, 3, 8, 27, 216]
- [2, 3, 8, 26, 312]
- [2, 3, 8, 25, 600]
- [2, 3, 8, 40, 60]
- [2, 3, 8, 42, 56]
- [2, 3, 8, 33, 88]
- [2, 3, 9, 36, 36]
- [2, 3, 9, 27, 54]
- [2, 3, 9, 24, 72]
- [2, 3, 9, 21, 126]
- [2, 3, 9, 20, 180]
- [2, 3, 9, 19, 342]
- [2, 3, 9, 30, 45]
- [2, 3, 9, 22, 99]
- [2, 3, 10, 30, 30]
- [2, 3, 10, 20, 60]
- [2, 3, 10, 18, 90]
- [2, 3, 10, 16, 240]
- [2, 3, 10, 24, 40]
- [2, 3, 11, 22, 33]
- [2, 3, 11, 14, 231]
- [2, 3, 11, 15, 110]
- [2, 3, 12, 24, 24]
- [2, 3, 12, 18, 36]
- [2, 3, 12, 16, 48]
- [2, 3, 12, 15, 60]
- [2, 3, 12, 14, 84]
- [2, 3, 12, 13, 156]
- [2, 3, 12, 20, 30]
- [2, 3, 12, 21, 28]
- [2, 4, 5, 40, 40]
- [2, 4, 5, 30, 60]
- [2, 4, 5, 25, 100]
- [2, 4, 5, 24, 120]
- [2, 4, 5, 22, 220]
- [2, 4, 5, 21, 420]
- [2, 4, 5, 28, 70]
- [2, 4, 5, 36, 45]
- [2, 4, 6, 24, 24]
- [2, 4, 6, 18, 36]
- [2, 4, 6, 16, 48]
- [2, 4, 6, 15, 60]
- [2, 4, 6, 14, 84]
- [2, 4, 6, 13, 156]
- [2, 4, 6, 20, 30]
- [2, 4, 6, 21, 28]
- [2, 4, 7, 14, 28]
- [2, 4, 7, 10, 140]
- [2, 4, 7, 12, 42]
- [2, 4, 8, 16, 16]
- [2, 4, 8, 12, 24]
- [2, 4, 8, 10, 40]
- [2, 4, 8, 9, 72]
- [2, 4, 9, 12, 18]
- [2, 4, 10, 12, 15]
- [2, 5, 5, 20, 20]
- [2, 5, 5, 15, 30]
- [2, 5, 5, 12, 60]
- [2, 5, 5, 11, 110]
- [2, 5, 5, 14, 35]
- [2, 5, 6, 10, 30]
- [2, 5, 6, 8, 120]
- [2, 5, 6, 12, 20]
- [2, 6, 6, 12, 12]
- [2, 6, 6, 9, 18]
- [2, 6, 6, 8, 24]
- [2, 6, 6, 7, 42]
- [2, 6, 6, 10, 15]
- [3, 3, 4, 24, 24]
- [3, 3, 4, 18, 36]
- [3, 3, 4, 16, 48]
- [3, 3, 4, 15, 60]
- [3, 3, 4, 14, 84]
- [3, 3, 4, 13, 156]
- [3, 3, 4, 20, 30]
- [3, 3, 4, 21, 28]
- [3, 3, 5, 15, 15]
- [3, 3, 5, 10, 30]
- [3, 3, 5, 9, 45]
- [3, 3, 5, 8, 120]
- [3, 3, 5, 12, 20]
- [3, 3, 6, 12, 12]
- [3, 3, 6, 9, 18]
- [3, 3, 6, 8, 24]
- [3, 3, 6, 7, 42]
- [3, 3, 6, 10, 15]
- [3, 4, 4, 12, 12]
- [3, 4, 4, 8, 24]
- [3, 4, 5, 6, 20]
- [3, 5, 5, 6, 10]
- [4, 4, 4, 8, 8]
- [4, 4, 4, 6, 12]
- [4, 4, 4, 5, 20]
- [2, 3, 7, 84, 84]
- [2, 3, 7, 63, 126]
- [2, 3, 7, 56, 168]
- [2, 3, 7, 49, 294]
- [2, 3, 7, 48, 336]
- [2, 3, 7, 45, 630]
- [2, 3, 7, 44, 924]
- [2, 3, 7, 43, 1806]
- [2, 3, 7, 70, 105]
- [2, 3, 7, 54, 189]
- [2, 3, 7, 46, 483]
- [2, 3, 7, 60, 140]
- [2, 3, 7, 51, 238]
- [2, 3, 7, 78, 91]
- [2, 3, 8, 48, 48]
- [2, 3, 8, 36, 72]
- [2, 3, 8, 32, 96]
- [2, 3, 8, 30, 120]
- [2, 3, 8, 28, 168]
- [2, 3, 8, 27, 216]
- [2, 3, 8, 26, 312]
- [2, 3, 8, 25, 600]
- [2, 3, 8, 40, 60]
- [2, 3, 8, 42, 56]
- [2, 3, 8, 33, 88]
- [2, 3, 9, 36, 36]
- [2, 3, 9, 27, 54]
- [2, 3, 9, 24, 72]
- [2, 3, 9, 21, 126]
- [2, 3, 9, 20, 180]
- [2, 3, 9, 19, 342]
- [2, 3, 9, 30, 45]
- [2, 3, 9, 22, 99]
- [2, 3, 10, 30, 30]
- [2, 3, 10, 20, 60]
- [2, 3, 10, 18, 90]
- [2, 3, 10, 16, 240]
- [2, 3, 10, 24, 40]
- [2, 3, 11, 22, 33]
- [2, 3, 11, 14, 231]
- [2, 3, 11, 15, 110]
- [2, 3, 12, 24, 24]
- [2, 3, 12, 18, 36]
- [2, 3, 12, 16, 48]
- [2, 3, 12, 15, 60]
- [2, 3, 12, 14, 84]
- [2, 3, 12, 13, 156]
- [2, 3, 12, 20, 30]
- [2, 3, 12, 21, 28]
- [2, 3, 13, 13, 78]
- [2, 3, 14, 14, 42]
- [2, 3, 15, 15, 30]
- [2, 3, 16, 16, 24]
- [2, 3, 18, 18, 18]
- [2, 4, 5, 40, 40]
- [2, 4, 5, 30, 60]
- [2, 4, 5, 25, 100]
- [2, 4, 5, 24, 120]
- [2, 4, 5, 22, 220]
- [2, 4, 5, 21, 420]
- [2, 4, 5, 28, 70]
- [2, 4, 5, 36, 45]
- [2, 4, 6, 24, 24]
- [2, 4, 6, 18, 36]
- [2, 4, 6, 16, 48]
- [2, 4, 6, 15, 60]
- [2, 4, 6, 14, 84]
- [2, 4, 6, 13, 156]
- [2, 4, 6, 20, 30]
- [2, 4, 6, 21, 28]
- [2, 4, 7, 14, 28]
- [2, 4, 7, 10, 140]
- [2, 4, 7, 12, 42]
- [2, 4, 8, 16, 16]
- [2, 4, 8, 12, 24]
- [2, 4, 8, 10, 40]
- [2, 4, 8, 9, 72]
- [2, 4, 9, 9, 36]
- [2, 4, 9, 12, 18]
- [2, 4, 10, 10, 20]
- [2, 4, 10, 12, 15]
- [2, 4, 12, 12, 12]
- [2, 5, 5, 20, 20]
- [2, 5, 5, 15, 30]
- [2, 5, 5, 12, 60]
- [2, 5, 5, 11, 110]
- [2, 5, 5, 14, 35]
- [2, 5, 6, 10, 30]
- [2, 5, 6, 8, 120]
- [2, 5, 6, 12, 20]
- [2, 5, 7, 7, 70]
- [2, 5, 8, 8, 20]
- [2, 5, 10, 10, 10]
- [2, 6, 6, 12, 12]
- [2, 6, 6, 9, 18]
- [2, 6, 6, 8, 24]
- [2, 6, 6, 7, 42]
- [2, 6, 6, 10, 15]
- [2, 6, 8, 8, 12]
- [2, 7, 7, 7, 14]
- [2, 8, 8, 8, 8]
- [3, 3, 4, 24, 24]
- [3, 3, 4, 18, 36]
- [3, 3, 4, 16, 48]
- [3, 3, 4, 15, 60]
- [3, 3, 4, 14, 84]
- [3, 3, 4, 13, 156]
- [3, 3, 4, 20, 30]
- [3, 3, 4, 21, 28]
- [3, 3, 5, 15, 15]
- [3, 3, 5, 10, 30]
- [3, 3, 5, 9, 45]
- [3, 3, 5, 8, 120]
- [3, 3, 5, 12, 20]
- [3, 3, 6, 12, 12]
- [3, 3, 6, 9, 18]
- [3, 3, 6, 8, 24]
- [3, 3, 6, 7, 42]
- [3, 3, 6, 10, 15]
- [3, 3, 7, 7, 21]
- [3, 3, 8, 8, 12]
- [3, 3, 9, 9, 9]
- [3, 4, 4, 12, 12]
- [3, 4, 4, 8, 24]
- [3, 4, 5, 5, 60]
- [3, 4, 5, 6, 20]
- [3, 4, 6, 6, 12]
- [3, 5, 5, 5, 15]
- [3, 5, 5, 6, 10]
- [3, 6, 6, 6, 6]
- [4, 4, 4, 8, 8]
- [4, 4, 4, 6, 12]
- [4, 4, 4, 5, 20]
- [5, 5, 5, 5, 5]
复制代码 |