"Love is in the N2-O2-Ar-CO2-Ne-He-CH4" is an episode of Season 27. It's a Valentine themed episode about Professor Frink.  It is the 13th episode of Season 27.
Lonely Professor Frink uses science to turn himself into a man whom women find attractive. Then, overwhelmed by the attention, he invents an algorithm to perfectly pair the lonely men and women of Springfield, realizing that scientific exploration is his true love. Meanwhile, Marge, Bart, and Lisa visit Grampa for Valentine’s Day and try to rescue the old folks from a drug-induced hallucination that allows them to relive their happiest memories. 
Smithers reminds Mr. Burns about Valentine's Day and tries to convince him to let the employees leave early to stay with their loved ones. Mr. Burns refuses, but Smithers convinces him to host a Sweethearts dance. While enjoying the party with Marge, Homer gets a phone call from Grampa, saying that he's alone and scared that a cat who can smell death is staring at him.
Homer and Marge decide to visit Grampa, spending the rest of Valentine's Day with him, but at the Retirement Castle, a nurse gives a pill to the elders, making them hallucinate and start dancing with the ghosts of late loved ones. Marge thinks it's not fair to do that with the old folks and decides to do something about it.
Meanwhile at the party, Professor Frink is alone because he's not good in getting a girlfriend. The next day, Homer discovers him sleeping in one of the Nuclear Plant's rooms. Frink confesses that Valentine's day is a difficult day for people like him. Homer explains that love is a matter of trial and error, and Frink gets the idea of determine what girls like on a man and use science to become that person. Frink replaces his glasses with invisible blue contact lenses and uses shoe lifts for him to look taller, but even a droid that he programmed to say only "yes" still think he's not attractive. Homer suggests it could be because of his voice, so Frink decides to use a chip under his tongue to make his voice more attractive.
To test his new self, Frink goes to a Yoga class. He manages to impress all the girls in there, but he soon notices that he can't handle his new life and decides to hide inside Moe's Tavern, where he realizes that most men there are lonely. He brings all the women to Springfield Observatory, but instead of telling which woman he has chosen to be his girlfriend, he pairs them up the lonely men of Springfield, and decides to go back to his life as a single scientist.
At the Simpsons' house, Marge discovers that Bart is taking advantage of the old people's hallucinations to win money on gambling. She takes them back to the Retirement Castle only to discover that the nurse gives powerful drugs to them only to ease her job, and manages to convince the nurse to stop medicating them.
The next day, Marge realizes that the elders are extremely depressed. The nurse says that she hid the drugs in the library, but Abe found the pills and took them so he could start hallucinating and win Mona back. During his hallucination, Marge, Bart and Lisa convince Abe to leave the past behind and live in the present, where there are people that still love him.
The episode ends with Frink watching the stars with his robot companion, only to get interrupted by her mother, another robot that Frink built.