Finding the next prime number from a given number

    Posted by Rogério Carvalho Schneider
    29 Aug 2009

    Finding the next prime number online is useful if you do not have time to calculate it but need a good seed for your hash.

    export start_number=250000
    curl -s "${start_number}" | sed -n -e 's#.*The smallest prime greater than.*<font color=.*>\(.*\)</font></div></td></tr><tr>.*#\1#p'

    This can be good the help you finding which number to use when tuning Varnish for better performance with the classic hash algorithm, avoiding bucket collision when having a big number of objects, making hash lookups faster.

    Favorites View Comments