I want to learn how to solve Harper's equation and plot the Hofstader butterfly spectrum numerically. Can anyone suggest references/links where this is done?
Have a look at a recent paper . This may be what you are looking for. Since it is recent, you can look at its references to look backwards for more traditional methods that are perhaps less accurate.
 Colbrook, Matthew J., Bogdan Roman, and Anders C. Hansen. "How to compute spectra with error control." Physical review letters 122.25 (2019): 250201.