Scientists accidentally discover a material that can ‘remember’ like a brain