It was discovered that older people who are sexually active have better mental processes that help us gather and process information, including memory.

According to new research, having sex could be one of the cheapest ways you can reduce memory loss. This research was led by Mark Allen from the University of Wollongong in Australia. Allen looked at data from more than 6,000 adults over the age of 50, and analysed information about their diet, health, well-being, and socio-economic status. They had all also completed a memory task and a questionnaire where they reported how much sex they had. After two years, they completed another memory test.
Results showed that more frequent sexual activity, including kissing and greater emotional closeness, were associated with better memory performance — and this link was stronger among older participants.
Overall, people’s memory performance worsened over the two years, and sexual activity only seemed to help with short-term memory tasks. There was no evidence to suggest sex helped declining memory in the long run.
Source: https://www.businessinsider.com/sex-could-improve-memory-2018-6