Set Manipulation Example (omode04)
/***************************************************************/
/* */
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: omode04 */
/* TITLE: Set Manipulation Example (omode04) */
/* PRODUCT: OR */
/* SYSTEM: ALL */
/* KEYS: OR */
/* PROCS: OPTMODEL */
/* DATA: */
/* */
/* SUPPORT: UPDATE: */
/* REF: */
/* MISC: Example 4 from the OPTMODEL chapter of */
/* Mathematical Programming. */
/* */
/***************************************************************/
proc optmodel;
number maxprime; /* largest number to consider */
set composites =
union {i in 3..sqrt(maxprime) by 2} i*i..maxprime by 2*i;
set primes = {2} union (3..maxprime by 2 diff composites);
maxprime = 500;
put primes;
maxprime = 50;
put primes;
quit;