Anonymous user
Miller–Rabin primality test: Difference between revisions
m
→{{header|REXX}}: added a comment to the REXX section header.
m (→{{header|REXX}}: folded one statement.) |
m (→{{header|REXX}}: added a comment to the REXX section header.) |
||
Line 2,899:
This would be in the same vein as:
3 is prime, 5 is prime, 7 is prime, all odd numbers are prime.
The '''K''' (above) is signified by the REXX variable '''times''' in the REXX program below.
<br>To make the program small, the true prime generator was coded to be small, but not particularly fast.
<lang rexx>/*REXX program puts the Miller─Rabin primality test through its paces. */
parse arg limit
if limit=='' | limit==',' then limit=1000 /*Not specified? Then use the default.*/
if
numeric digits max(200, 2*limit) /*we're dealing with some ginormous #s.*/
tell=
call genPrimes limit /*suspenders now, use a belt later ··· */
@MRpt= 'Miller─Rabin primality test' /*define a character literal for SAY. */
say "There are" # 'primes ≤' limit /*might as well display some stuff. */
say /* [↓] (skipping unity); show sep line*/
do a=2 to
mrp=0 /*counter of primes for this pass. */
do z=1 for limit /*now, let's get busy and crank primes.*/
|