algorithmuscanorj

Demonstrative program about: www.oeis.org/a217626

Dec 14th, 2012
476
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.   Demonstrative PARI/GP program about some structural properties of the A217626 sequence.
  3.  
  4.   Usage instructions:
  5.  
  6.  1) Download and decompress (format Gzip), the following file: http://www.oeis.org/w/images/d/d7/B-file_woOffset.txt.gz
  7.  2) Place together both files (the data file and this program) in the same directory of your choice.
  8.  3) Before running ensure that the usual favorable conditions are present in your system.
  9.    (file/execution permissions, the GP interpreter works properly, ...)
  10.  4) Run the program.
  11.  
  12.  Note(s):
  13.  --------
  14.  
  15.  Ending conjecture by: R. J. Cano, Dec 12 2012
  16.  
  17. */
  18. v23=[1, 9, 2, 9, 1, 78, 1, 19, 3, 8, 2, 77, 2, 8, 3, 19, 1, 78, 1, 9, 2, 9, 1];
  19. v03=[9,2,9];
  20. print("  Number of times that the following palindromics:");
  21. print(" ");
  22. print(v23);
  23. print("  and");
  24. print(v03);
  25. print("  ");
  26. print("Are present repeated inside the first N! terms of the sequence A217626.");
  27. print(" ");
  28. print("Setting up the execution environment. ");
  29. default(parisize,100663296);
  30. print("Loading b-file (without Offsets) data.");
  31. x=readvec("B-file_woOffset.txt");
  32. print("Ready.");
  33. print(" ");
  34. print("Running the counter algorithm(s). Please wait...");
  35. Omega=10; \\ Defined according the data. It means (10!/2) terms of A217626 stored in the data file to be uploaded.
  36. unit=vector(Omega);
  37. count929(Q)={unit[Q]=1;z=0+(Q==3);for(s=3,Q!/2,e=1;for(k=0,2,e*=(v03[3-k]==x[s-k]));if(e,z++);if(x[s]==1,unit[Q]++));if(Q>=3,unit[Q]*=2);(if(Q>3,2,1)*z)};
  38. antifac(n)={ans=0;while((ans+1)!<= n, ans++);ans};
  39. palindrocount(N)={tester=vector(23); Q=22;L=N!/2;times=0;for(tau=1,L,G=x[tau];for(u=1,Q,tester[u]=tester[u+1]); tester[Q+1]=G; if(tester==v23,times++)); (2*times+(N==4))};
  40. tab="          ";
  41. tab2="       ";
  42. z=vector(Omega,w,count929(w));
  43. f=vector(10);
  44. for(w=4,10,f[w]=palindrocount(w));
  45. print(" ");
  46. print("About: ",v03);
  47. print(" ");
  48. print("  #terms in                  Counts:");
  49. print("  data file",tab,tab,"{1}929{1}     unit(total)      unit(NOT belonging to such palindromic)");
  50. for(u=2,Omega,print(tab,u,"!-1",tab,tab,antifac(z[u]),"!",tab,antifac(unit[u]),"!",tab,tab,2*(u==2)+(u-3)*(u-2)!,if(u>=7,"= 20*"," "),if(u>=7,((u-3)*(u-2)!)/20," ")));
  51. print(" ");
  52. print("  Notice from the table that every multiple of (N-2)! is 0 (mod 20) for N equal or greater than 7.");
  53. print(" ");
  54. print("  Upon being true as consequence of the identity: (N-2)!=5!*prod_{k=1..N-7}(5+k) when N>=7...");
  55. print(" ");
  56. print("  Such fact doesn't come randomly. It is strongly related to a combinatorial-periodic pattern recently");
  57. print("  identified while studying A218976, when the 5-adic valuation of \"y\" -any given positive integer-");
  58. print("  was replaced with the overestimation: f(y)=floor(y/20)+floor(y/5)");
  59. print(" ");
  60. print("About: ",v23);
  61. print(" ");
  62. print("--[N]----- Count(s) ----------");
  63. for(w=4,10,print("   ",w,")",tab2,antifac(f[w]),"!"));
  64. print("------------------------------");
  65. print(" ");
  66. print("Conjecture: (N-3)! times for every N greater than 3.");
  67. print(" ");
  68. quit;
Add Comment
Please, Sign In to add comment