algorithmuscanorj

PARI port for A181936 sequencer (from MAPLE)

Jan 5th, 2013
674
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. siZe=28;
  2.  
  3. a181936_list(DIM)={
  4. my(E);
  5. E=matrix(DIM,DIM);
  6. E[1,1]=1;
  7. for(n=2,DIM,
  8.   if(!((n-1)%5),
  9.     E[n,1]=0;
  10.     forstep(k=n-1,1,-1,
  11.       E[k,n-k+1]= ( E[k+1,n-k] + E[k,n-k] )
  12.     ),
  13.     E[1,n]=0;
  14.     for(k=2,n,
  15.       E[k,n-k+1]= ( E[k-1,n-k+2] + E[k-1,n-k+1] )
  16.     )
  17.   )
  18. );
  19. ans=vector(DIM,k,(k==1)*E[1,1]+(k!=1)*(E[k,1]+E[1,k]));
  20.  
  21. };
  22.  
  23. table=a181936_list(siZe);
  24. for(j=1,#table,print((j-1)," ",table[j]));
  25. quit();
RAW Paste Data