A 13-year-old boy from Texas won a national math competition on Monday with an answer rooted in probabilities — and a dash of farming.

The boy, Luke Robitaille, took less than a second to buzz in at the Raytheon Mathcounts National Competition with the correct answer.

The question: In a barn, 100 chicks sit peacefully in a circle. Suddenly, each chick randomly pecks the chick immediately to its left or right. What is the expected number of unpecked chicks?

(We will give you the answer at the end.)

The Scripps National Spelling Bee frequently gains attention for the nail-biting drama of watching students stand on a stage under hot lights to respond to questions.

The math competition was no less challenging.

Contestants can use only a pencil and paper and have 45 seconds to solve word problems such as this one answered by the winner in 2014: The smallest integer of a set of consecutive integers is -32. If the sum of these integers is 67, how many integers are in the set?

(That answer is also below.)

For Luke, a seventh-grader from Euless, Texas, who is home schooled, the victory meant beating a teammate from Texas in the final round. As national champion, he will receive a $20,000 college scholarship and a trip to Space Camp in Huntsville, Alabama.

“You get to think about things and move logically toward solving problems,” said Luke, who came in second place at last year’s competition.

The contest, which was open to students in the sixth, seventh and eighth grades, took place at a hotel ballroom in Lake Buena Vista, Florida, before an audience of 1,000 people.

A written test was given on Sunday to 224 contestants; the 12 highest-scoring students advanced to the final round on Monday. The first contestant to score four correct answers won.

The score was 3-3 when Luke buzzed in with his winning answer.

The competition is a way to promote skills in science, technology, engineering and mathematics — known as the STEM fields, Pamela Erickson, vice president of global brand and corporate citizenship at Raytheon, an aerospace and defense company, said Monday.

In 2012, the President’s Council of Advisors on Science and Technology projected that the United States during the next decade would need about 1 million more STEM professionals than the country produced at its current rate to maintain its supremacy in science and technology. To do that would mean increasing the number of students earning STEM degrees by about 34 percent annually, the council said.

“We feel that pain, and it’s a real concern for us,” Erickson said.

(Incidentally, the winner that year answered this question correctly: A bag of coins contains only pennies, nickels and dimes with at least five of each. How many different combined values are possible if five coins are selected at random?)

Lou DiGioia, executive director of Mathcounts, said the contestants’ achievements were the results of endless hours of practice and coaching and not necessarily innate math abilities.

“These are not natural prodigies,” he said. “Nobody watches a basketball game and says, ‘Oh, LeBron James was born that way.'”

The gap between the supply and demand of STEM workers promises to grow, he added.

8 of the very hardest maths puzzles Show all 8 1 /8 8 of the very hardest maths puzzles 8 of the very hardest maths puzzles Crossing the bridge Four people need to cross a rickety bridge at night. Unfortunately, they have only one torch and the bridge is too dangerous to cross without one. The bridge is only strong enough to support two people at a time. Not all people take the same time to cross the bridge. Times for each person: 1 minute, 2 minutes, 7 minutes, and 10 minutes. What is the shortest time needed for all four of them to cross the bridge? Claire Backhouse/flickr/Creative Commons 8 of the very hardest maths puzzles Number magic If you multiply me by 2, subtract 1, and read the reverse the result you’ll find me. Which numbers can I be? Dustin Liebenow/flickr/Creative Commons 8 of the very hardest maths puzzles One thousand monkeys A very big building in which one thousand monkeys are living is lighted by one thousand lamps. Every lamp is connected to a unique on/off switch, which are numbered from 1 to 1000. At some moment, all lamps are switched off. But because it is becoming darker, the monkeys would like to switch on the lights. They will do this in the following way: Monkey 1 presses all switches that are a multiple of 1 Monkey 2 presses all switches that are a multiple of 2 Monkey 3 presses all switches that are a multiple of 3 Monkey 4 presses all switches that are a multiple of 4 Etc., etc. How many lamps are switched on after monkey 1000 pressed his switches? And which lamps are switched on? Buddhika Weerasinghe/Getty Images 8 of the very hardest maths puzzles School lockers A high school has a strange principal. On the first day, he has his students perform an odd opening day ceremony: There are one thousand lockers and one thousand students in the school. The principal asks the first student to go to every locker and open it. Then he has the second student go to every second locker and close it. The third goes to every third locker and, if it is closed, he opens it, and if it is open, he closes it. The fourth student does this to every fourth locker, and so on. After the process is completed with the thousandth student, how many lockers are open? Brett Levin/flickr/Creative Commons 8 of the very hardest maths puzzles One bulb, three switches You have three switches in a room. One of them is for a bulb in next room. You cannot see whether the bulb is on or off until you enter the room. What is the minimum number of times you need to go in to the room to determine which switch corresponds to the bulb in next room? JOEL SAGET/AFP/Getty Images 8 of the very hardest maths puzzles Cheryl's birthday Albert and Bernard just become friends with Cheryl, and they want to know when her birthday is. Cheryl gives them a list of 10 possible dates: May 15, May 16, May 19, June 17, June 18, July 14, July 16, August 14, August 15, and August 17 Cheryl then tells Albert and Bernard separately the month and the day of her birthday respectively. Albert: I don’t know when Cheryl’s birthday is, but I know that Bernard does not know too. Bernard: At first I don’t know when Cheryl’s birthday is, but I know now. Albert: Then I also know when Cheryl's birthday is. So when is Cheryl’s birthday? Jessica Diamond/flickr/Creative Commons 8 of the very hardest maths puzzles Sunday's child Recently, somebody said: “My grandfather was born on the first Sunday of the year. His seventh birthday was also on a Sunday.” In which year was said grandfather born? Will Clayton/flickr/Creative Commons 8 of the very hardest maths puzzles Probability of having boy In a country where everyone wants a boy, each family continues having babies until they have a boy. After some time, what is the proportion of boys to girls in the country? (Assuming probability of having a boy or a girl is the same). WALTRAUD GRUBITZSCH/AFP/Getty Images

“If we have a shortfall today and the rate of acceleration is going to continue, there is going to be a problem,” he said. “Anyone can do the math on that.”

(Did you give up yet? Luke’s winning response was 25 chicks. The answer to the question from last year: 67 integers. And the answer to the 2012 question about the bag of coins: 21.)