Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (PARI) \\"Slow" sequencer program only for the first N! terms in a215940 (2<=N<=9)
- alphaperm(n, r)=if(n==1, r, r*10^(n-1)+alphaperm(n-1, r+1));
- omegaperm(n)=if(n==1, 1, n*10^(n-1)+omegaperm(n-1));
- factoromu(n, k)=if(k==0, 1, {ans=1; while(((k-ans)%10!=0), ans++); ans*factoromu(n, (k-ans)/10)})
- factorosu(n, k)=if(k==0, 0, {ans=1; while(((k-ans)%10!=0), ans++); ans^2+factorosu(n, (k-ans)/10)})
- b215940(lambda)= {
- A=alphaperm(lambda, 1);
- B=omegaperm(lambda);
- C=lambda!;
- D=lambda^3/3+lambda^2/2+lambda/6;
- for(y=0, (B-A)/9, if( (factoromu(lambda, 9*y+A)==C) && (factorosu(lambda, 9*y+A)==D) , print(y), 0));
- } \\ - This routine verifies 3 mathematical properties of permutations without repetitions.
- print("Example: The call b215940(4); returns, ");
- b215940(4);
- quit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement