A rat study has found that increased levels of magnesium in the brain improved many aspects of learning and memory in both young and old rats. Because it is difficult to boost brain magnesium levels with traditional oral supplements, the researchers developed a new magnesium compound, magnesium-L-threonate (MgT). The cognitive improvements were associated with an increase in synapses and improved synaptic plasticity. It’s important to note that the control rats had a normal diet which is widely accepted to contain a sufficient amount of magnesium; thus the observed effects were due to elevation of magnesium to levels higher than provided by a normal diet. It is also estimated that half the population of industrialized countries has a magnesium deficit, which increases with aging. See here for a list of magnesium-rich foods.
 . Enhancement of Learning and Memory by Elevating Brain Magnesium. Neuron [Internet]. 2010 ;65(2):165 - 177. Available from: http://www.cell.com/neuron/abstract/S0896-6273(09)01044-7