algorithmuscanorj

A055881 and PARI

Jan 7th, 2013
621
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  *  Another demonstrative program: An alternative sequencer for A055881.
  3.  *  R. J. Cano, Jan 7 2013
  4. */
  5.  
  6. U=3; \\ Upperbound.
  7.  
  8. default(echo,1);
  9.  
  10. output01(input01)={
  11.   my(
  12.     siZe1=#input01,
  13.     siZe2=(input01[siZe1]+1)!,
  14.     ans=vector(siZe2,k,input01[(k-1)%siZe1+1])
  15.   );
  16.   ans[siZe2]++;
  17.   ans;
  18. };
  19.  
  20. \\ print("\n\n**Please always remember pre-allocate enough mem for your task in the command line invokation.**\n\n");
  21.  
  22. v1=[1];
  23.  
  24. for(k=0,U,if(k>0,v2=output01(v1);v1=v2);print(v1));
  25.  
  26. quit();
  27.  
  28. /*
  29.  * Acknowledgements: To M.F. Hasler and Joerg Arndt.
  30.  *
  31. */
RAW Paste Data