The priority of a transaction is (the sum of (coin age in blocks * coin value in satoshis) over all the inputs in the transaction) divided by the size of the transaction in bytes.

Here's a [random example transaction][2] copied from http://bitcoincharts.com/bitcoin/txlist/:

![enter image description here][1]

It has 2 inputs (both of which have since been spent in other (confirmed) transactions rendering this transaction unconfirmable):

  * one for 0.1005 BTC from block 165774
  * one for 0.0995 BTC from block 165777

It is 439 bytes long, and has a priority of 432,232,688.

The most recent blocks in the blockchain is 175262 at the time of writing.

I sum the (age * values) for each transaction and divide by size.  The `+ 1` is because transactions confirmed in the newest block are considered to have an age of 1, not 0:

    >>> current_block = 175262
    >>> ((current_block - 165774 + 1) * 0.1005e8 +
         (current_block - 165777 + 1) * 0.0995e8) / 439
    432232687.92710704

As you can see, the priority of a transaction will go up as new blocks are found.

  [1]: https://i.sstatic.net/nVK40.png
  [2]: http://bitcoincharts.com/bitcoin/txlist/#634144b781af98f6953f035d00fb7750d96df56709e89ff87bd2d9ca98cba810