Carbon Nanotube Inter- and Intramolecular Logic Gates