You say no one in their right mind would pay $100 for a pencil... but they would, if it was the last pencil left on Earth!! But typically most simulations like this one wouldn't deal with such low supply. Typically you would want to write a function that is accurate from 1000 to 100000 or something, and just ignore the crazy numbers that result at 1.
Anyway, have a look at this document: http://www.csun.edu/~dgw61315/PTlect2y.pdf Page 4 has a simple mathematical example of a market.