A Random Bashing - primes

Ben Trussell azlobo73 at gmail.com
Sat Jan 8 21:18:45 MST 2011


A Random Act of Bashing...  Find all primes between <arg1> and <arg2>
(expects/assumes integer values) and print to sdtout..

-------
#!/bin/bash

for (( a=$1; a<=$2; a++ ))
do
        n=`factor $a|awk '{print $NF}'`
        if [ $a == $n ]
        then
                echo $a
        fi
done
-------

EOF

- Ben


More information about the PLUG-discuss mailing list