Dense Associative Memory for Pattern Recognition