You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

9 lines
441 B

dnl M4 version of a prime number finder
dnl haplo@mindstab.net
dnl
dnl ARGS: CNT, I, MAX
define(CHECK, `ifelse(eval($2>$3),1,1, eval($1 % $2),0,0, `CHECK($1,eval($2+2),$3)')')dnl
dnl ARGS: CNT MAX SQ SQTOP
define(PRIMES,`ifelse(eval($1 < $2),1, `ifelse(eval($1>$4),1, `PRIMES($1,$2,eval($3+1),eval(($3+1)**2))', `ifelse(eval(CHECK($1,3,$3) != 0), 1, $1)
PRIMES(eval($1+2),$2,$3,$4)')')')dnl
dnl autotest call will be inserted here via sed