Could it be Teens in the Universe? According to TVTropes, it has a scene where the eponymous teens run down a corridor, shorting out robots with a riddle about numbers (equivalent to the English one of "Why was six afraid of seven?"), only to find that the boss robot can solve it.
Moscow — Cassiopeia ("Москва — Кассиопея") and Teens in the Universe ("Отроки во Вселенной") are a Soviet sci-fi movie duology premiered in 1973 and 1974, respectively.
The films follow a group of teenagers who are sent on an antimatter-powered relativistic starship to the Cassiopeia constellation after Soviet scientists receive an alien signal from one of its stars. After selecting the crew consisting of the best students (one mentions he was chosen for his Eidetic Memory) and building a starship capable of reaching near-light speeds, they are launched on a mission to make First Contact with the mysterious senders of the signal. A stowaway accidentally sits on the ship controls and causes it to accelerate beyond the speed of light. While the journey does take several decades for those Earth-bound, it takes only moments for the starship crew. They arrive and encounter a ship of Human Aliens who manage to learn Russian ridiculously quickly. They explain that they are the last of their race, after their robots Turned Against Their Masters. However, instead of killing their creators, the robots sought to "improve" them by removing their emotions. This caused the entire race to stop reproducing, and they died out. Only those who were in space at the time of the revolt managed to survive. The teens decide to help the aliens retake their planet by shutting down the robots' master control. They finally manage to do that, at which point the aliens get their planet back, and the teens are informed by a Soviet government agent (who appears out of nowhere) that they are free to head home, as a diplomatic and humanitarian mission is on the way from Earth.
They ask the drones the riddle at 48:52 in (It doesn't translate well, but the translation I've seen runs along the lines of "A & B sit in a tree. A falls out. B falls out. Who is left?" where the answer is "&" because it's a Cyrillic letter that's also used as a conjunction).
Them asking the main robot the question happens at 1:05:36 in.
Although, on watching it, they short out the robots before the corridor that they run down.