algorithmuscanorj

Experimental trainning #0173 (Jan 4th 2013)

Jan 4th, 2013
620
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  *
  3.  
  4. Instructions:
  5.  
  6.   1) Download the b-files for the following sequences: A173952, A003952, and A048441.
  7.  
  8.   2) Delete the offsets column in each b-file: In this step are generated the files
  9.  
  10.       b173952woOffstes.txt,
  11.       b003952woOffstes.txt, and
  12.       b048441woOffsets.txt
  13.      
  14.       Suggested method (Unix/Linux):
  15.      
  16.     Use the "cut" program (GNU file utils / core utils).
  17.    
  18.     Examples:
  19.    
  20.       a) In a command line shell try
  21.       ------------------------------------------------------------------------
  22.         seqfan@arithmoz$ cut -d' ' -f2 b173952.txt > b173952woOffsets.txt
  23.       ------------------------------------------------------------------------
  24.      
  25.       b) Or also
  26.       ------------------------------------------------------------------------
  27.         seqfan@arithmoz$ cut -f2 b173952.txt > b173952woOffsets.txt
  28.       ------------------------------------------------------------------------
  29.      
  30.     The proper invokation depends on which kind of separators are used inside the b-file
  31.     (either tabs or whitespaces).
  32.      
  33.   3) Place the files generated in the step-2 at the same directory, and run
  34.   this script there.
  35.  
  36. *  
  37. */
  38.  
  39. luckyUpperBound=10; /* Just it, a bound. */
  40.  
  41. E=readvec("b048441woOffsets.txt");  /* All available terms for A048441 in OEIS */
  42. conservativeUpperBound=min(20,#E);
  43. A=readvec("b173952woOffsets.txt");  /* All the known terms for A173952 */
  44. B0=readvec("b003952woOffsets.txt");
  45. B=vector(#B0-1,k,B0[k+1]);          /* Terms in A003952 excepting the first. */
  46.  
  47. C=vector(#A-1,k,A[k+1]-sum(j=1,k-1,A[j]));  /* A particular kind of "First differences" for A173952... */
  48. C/=2^5;                                     /* ... divided by 2^5. */
  49.  
  50. D=vector(min(min(#B,#C),#E),k,B[k]-C[k]);   /* More differences: This time between A003952 and the previous definition for A173952 */
  51.  
  52. /*==================
  53.       Sumary
  54. ==================*/
  55.  
  56. for(i=1,luckyUpperBound,print(D[i]));
  57. print("\nWith the exception of the two zeroes at the beginning, these \nnumbers listed previously are the first ",luckyUpperBound-2," terms of A048441.");
  58. printf("\n\nNow these other numbers liste below are the differences against the next terms of A048441.\n");
  59. for(j=luckyUpperBound+1,conservativeUpperBound,print(E[j-2]-D[j]));
  60. quit();
RAW Paste Data