I stayed awake far too late one morning and created an algorithm that I would use to determine how much of a tip I should give. I'm generally a large tipper (30-100%, depending on the total cost of the meal, the quality and gender of my service and how long I stayed in the restuarant). Now, I've never actually used this system, but it sure seemed cool after being awake for thirty hours.
The natural logarithm of 42 is approximately 3.73766961828
Quality of service is determined by the customer.
Take the service level divided by ten and multiply the quotient by the logarithm of the answer to the ultimate question of life the universe and everything. (This idea was borrowed from the Linux kernel source code.)
The above action determines the value of the "s" variable used in the equation below.
Service scale:

        00 = Worst service
        01 = Poor service
        02 = Mediocre service
        03 = Average service
        04 = Good service
        05 = Great service
        06 = Grand service
        07 = Exceptional service
        08 = Fantastic service
        09 = Amazing service
        10 = Best service

tip = bill * 0.15 * s
totalbill = tip + bill
I later realized that in a restuarant, where a calculator isn't readily available, this method does not work very well and I end up tipping my regular fiver.