The Mathematics of Sharing