What's happening?

The Twilight Zone: 1x29

I of Newton

A frazzled mathematics professor accidentally summons a demon who will let him riddle to get free of the contract he accidentally invoked. The professor, Sam, has three questions to find a task the demon can’t accomplish, or a question he can’t answer, then challenge him after the questions are answered. The demon appears omnipotent, but Sam gives the demon a simple command: “”Get lost.”” The demon is banished and Sam goes back to work.

The Twilight Zone: Season 1 Episode 29
Dec. 13, 1985