New nanostructure combines memory and logic elements