A recursive formula for Thabit numbers