home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine 1995 / ARCHIVE95.iso / discs / pipeline / abacus / z_line / Primes / c_Prime next >
Text File  |  1993-10-24  |  5KB  |  94 lines

  1. {Version:1.05;01 Oct 1993;Fireworkz;Gerald Lewis Fitton;6500 1024 5321 6154}
  2. {Block:0;0;;32;3;33;;32;3;33}
  3. {Style:ZL Base Sheet;{ColWidth:1134}{ColName:x#}{RowHeight:336}{RowHeightFix:1}{RowUnbreakable:0}{RowName:#}{MarginLeft:114}{MarginRight:114}{MarginPara:0}{Tablist}{Background:255;255;255}{ParaStart:32}{ParaEnd:16}{LineSpace:0;72}{Justify:2}{JustifyV:0}{NewObject:1}{Numform:#,##0.00}{NumformDT:dd.mm.yy}{NumformSE:@}{BorderColour:0;0;0}{Border:0}{GridLeftColour:221;221;221}{GridTopColour:221;221;221}{GridRightColour:221;221;221}{GridBottomColour:221;221;221}{GridLeft:0}{GridTop:0}{GridRight:0}{GridBottom:0}{Protect:0}{Typeface:Helvetica}{Fontx:0}{Fonty:240}{Underline:0}{Bold:0}{Italic:0}{Superscript:0}{Subscript:0}{Foreground:0;0;0}}
  4. {StyleBase:ZL Base Sheet}
  5. {Style:ZL Head Foot;{ColWidth:11164}{MarginLeft:114}{MarginRight:114}{Tablist:C5385 R10771}{ParaStart:68}{ParaEnd:68}{LineSpace:0;72}{Justify:0}}
  6. {StyleHeaderFooter:ZL Head Foot}
  7. {Style:ZL Current Cell;{BorderColour:0;0;0}{Border:1}}
  8. {StyleCurrent:ZL Current Cell}
  9. {Style:ZL Text;{RowHeightFix:0}{Justify:0}{NewObject:3}}
  10. {StyleText:ZL Text}
  11. {Style:ZL Pounds;{Numform:ú#,##0.00}}
  12. {Style:ZL Percentage;{Numform:0.##%}}
  13. {Style:ZL 0dp;{Numform:0}}
  14. {Style:ZL 1dp;{Numform:0.0}}
  15. {Style:ZL Percent;{Numform:0.##%}}
  16. {Style:ZL Protection;{Protect:1}}
  17. {Style:ZL GridOff;{GridLeftColour:0;0;0}{GridTopColour:0;0;0}{GridRightColour:0;0;0}{GridBottomColour:0;0;0}{GridLeft:0}{GridTop:0}{GridRight:0}{GridBottom:0}}
  18. {Style:ZL GridOn;{GridLeftColour:0;0;0}{GridTopColour:0;0;0}{GridRightColour:0;0;0}{GridBottomColour:0;0;0}{GridLeft:2}{GridTop:2}{GridRight:2}{GridBottom:2}}
  19. {Paper:From Printer;0;16839;11907;737;341;341;341;0;0;0;0;32;;1}
  20. {PrintQuality:0}
  21. {StartOfData}
  22. {Name-S:numbertested;a22}
  23. {Name-S:last_prime;b9}
  24. {Name-S:number_under_test;b10}
  25. {Name-S:highest_divisor;b11}
  26. {Name-S:array_pointer;b12}
  27. {Name-S:prime_at_pointer;b13}
  28. {Name-S:remainder;b14}
  29. {S:X;X;0;0;Comments and Commands}
  30. {S:X;X;0;2;Custom function to find the next prime number}
  31. {S:X;X;0;3;given all lower prime numbers}
  32. {S:S;F;0;5;;function("nextprime","lowerprimes:array")}
  33. {S:X;X;0;7;Declare all local variables as names}
  34. {S:S;F;0;8;163;set_name("last_prime",b9)}
  35. {S:S;F;0;9;167;set_name("number_under_test",b10)}
  36. {S:S;F;0;10;13;set_name("highest_divisor",b11)}
  37. {S:S;F;0;11;6;set_name("array_pointer",b12)}
  38. {S:S;F;0;12;17;set_name("prime_at_pointer",b13)}
  39. {S:S;F;0;13;14;set_name("remainder",b14)}
  40. {S:X;X;0;15;Initialise local variables using set_value(name,value)}
  41. {S:S;F;0;16;167;set_value(last_prime,max(@lowerprimes))}
  42. {S:S;F;0;17;167;set_value(number_under_test,last_prime)}
  43. {S:S;F;0;18;13;set_value(highest_divisor,int(sqr(last_prime))+1)}
  44. {S:S;F;0;20;;repeat}
  45. {S:S;F;0;21;173;set_value(number_under_test,number_under_test+2)}
  46. {S:S;F;0;22;0;set_value(array_pointer,0)}
  47. {S:S;F;0;24;;repeat}
  48. {S:S;F;0;25;6;set_value(array_pointer,array_pointer+1)}
  49. {S:S;F;0;26;17;set_value(prime_at_pointer,index(@lowerprimes,1,array_pointer))}
  50. {S:S;F;0;27;3;set_value(remainder,mod(number_under_test,prime_at_pointer))}
  51. {S:S;F;0;28;;until((remainder=0)|(prime_at_pointer>highest_divisor))}
  52. {S:S;F;0;30;;until(prime_at_pointer>highest_divisor)}
  53. {S:S;F;0;32;;result(number_under_test)}
  54. {S:X;X;1;0;Value}
  55. {S:S;C;1;8;167}
  56. {S:S;C;1;9;173}
  57. {S:S;C;1;10;13}
  58. {S:S;C;1;11;6}
  59. {S:S;C;1;12;17}
  60. {S:S;C;1;13;3}
  61. {BR:;;;;;;;;1;1;{StyleHandle:ZL Base Sheet}}
  62. {R:5;;;;6;;;;1;0;{ColWidth:1815}}
  63. {R:6;;;;7;;;;1;0;{ColWidth:1815}}
  64. {R:3;;;;4;;;;1;0;{ColWidth:736}}
  65. {R:4;;;;5;;;;1;0;{ColWidth:849}}
  66. {R:2;0;;32;3;1;;32;0;0;{ColWidth:1134}}
  67. {R:0;0;;32;1;1;;32;0;0;{StyleHandle:ZL Text}}
  68. {R:0;2;;32;1;4;;32;0;0;{StyleHandle:ZL Text}}
  69. {R:0;5;;32;1;6;;32;0;0;{Justify:0}}
  70. {R:0;7;;32;1;8;;32;0;0;{StyleHandle:ZL Text}}
  71. {R:0;8;;32;1;14;;32;0;0;{Justify:0}}
  72. {R:0;15;;32;1;16;;32;0;0;{StyleHandle:ZL Text}}
  73. {R:0;16;;32;1;19;;32;0;0;{Justify:0}}
  74. {R:0;20;;32;1;23;;32;0;0;{Justify:0}}
  75. {R:0;24;;32;1;29;;32;0;0;{Justify:0}}
  76. {R:0;30;;32;1;31;;32;0;0;{Justify:0}}
  77. {R:0;32;;32;1;33;;32;0;0;{Justify:0}}
  78. {R:1;0;;32;2;1;;32;0;0;{StyleHandle:ZL Text}}
  79. {R:0;;;;1;;;;1;0;{ColWidth:7256}}
  80. {R:1;;;;2;;;;1;0;{ColWidth:849}}
  81. {PageHefoBreakValues-H:0;0;0;;1;397;0;0;;;0;;;1;0;0;0;;;0}
  82. {HD-H:0;2}
  83. {HBR-H:0;2;;32;;32;{StyleHandle:ZL Base Sheet}}
  84. {HBR-H:0;2;;32;;32;{StyleHandle:ZL Head Foot}}
  85. {HR-H:0;2;;32;;32;{Justify:0}}
  86. {HD-H:0;3}
  87. {HBR-H:0;3;;32;;32;{StyleHandle:ZL Base Sheet}}
  88. {HBR-H:0;3;;32;;32;{StyleHandle:ZL Head Foot}}
  89. {EndOfData}
  90. {CmdGroup:{ViewCreate:1008;11936;10976;10816}
  91. {ViewControl:100;0;0;0;1;1;0;2048;0;2048}
  92. {CurrentPosition:0;0;0;3}
  93. }
  94.