Most likely you need:
26 tpi (thread per inch)
On the website below there is a list off all Shimano gear hubs which use this size nut:
Please check if your hub is listed to ensure compatibility.
yes I'm pretty sure it should work. have not tried it myself but when you pump up a tube outside of the tire the diameter increases quite a lot (so the change in diameter from 26-27.5 or from 27.5-29") should not be an issue imo.