# clear the screen clear # loop for a powers of 2 progression 32-4194304 (inclusive) for((qty=32; qty<=4194304; qty*=2)); do # display the quantity lead-in information printf "[%7s] %7sth prime: " "${qty}" "${qty}" # obtain the last/largest prime in the specified quantity value=$(./primeregbmoa ${qty} 1 2>/dev/null | tr ' ' '\n' | tail -2 | head -1) # display it, along with calculating its approximate multiplier printf "%8s (x%s)\n" "${value}" $(echo "(${value}/${qty})+1" | bc -q) done