Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (PARI) \\ R.J. Cano, Dec 7th 2012.
- /*--> Proposed implementation for SJT algorithm <--*/
- GreatestAllowedSize=11;
- \\default(parisize, GreatestAllowedSize!*GreatestAllowedSize); \\ Please set it properly. Uncomment if necessary.
- fromZero=0; \\ About count starting from 0 or 1.
- f1(x)=(N-fromZero)*if((Mu[2]%2==0)&&((x-Mu[2]*Q[2])==N+Lambda[2]*(N-1)), c1=0; 1+f4(x), 0*(c1=1));
- f2(x)=(N-fromZero)*if((Mu[2]%2==1)&&((x-Mu[2]*Q[2])%(N+1)==1), c2=0; 1+f4(x), 0*(c2=1));
- f3(x)=if(c1*c2, ans=initial[Mu[1]*Q[1]+z]; if(m==(Q[2]-N) , Mu[1]++; m=1; z=1, m++; if(z==Q[1], z=1, z++)); ans);
- f4(x)=0*if(Lambda[2]==N-1, Mu[2]++; Lambda[2]=0, Lambda[2]++);
- SteinhausJhonsonTrotter(U)={initial=vector(1, w, w-fromZero); final=initial; N=1; while(N<U, N++; m=1; z=1; Q=[N-1, N^2]; Mu=[0, 0]; Lambda=[0, 0]; final=vector(N!*N, k, f1(k)+f2(k)+f3(k)); initial=final);
- (final)};
- /*----- VISUAL Sequencer for A207324: First 10, 000 terms ---------*/
- Terms=10000;
- groundOffset=0;
- for(Beta=1, 9, tmpv=SteinhausJhonsonTrotter(Beta); for(kappa=1, Beta!*Beta, print(groundOffset+kappa, " ", tmpv[kappa]); if(groundOffset+kappa==Terms, quit(); )); groundOffset+=Beta!*Beta);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement