Material ID Auto-assign

I was wondering if anyone knows of a script that will auto-assign Material ID #'s 1-15 to the first 15 materials in the material browser.

Otherwise, I'd like to use this as an opportunity to maybe start learning to script and write it myself. Any help/ suggestions would be welcome.