Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- declare -i start end
- declare -a array
- start=$1
- end=$2
- for n in $(seq 1 $end); do
- array[$n]=$n
- done
- array[1]=0
- for j in $(seq 1 $end); do
- if [ ${array[$j]} -eq 0 ]; then
- continue
- fi
- k=$(( $j + $j ))
- while [ $k -le $end ]; do
- array[$k]=0
- k=$(( $k + $j ))
- done
- done
- for j in $(seq 1 $end); do
- if [ ${array[$j]} -lt $start ] || [ ${array[$j]} -eq 0 ]; then
- continue
- fi
- echo ${array[$j]}
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement