BANGOR, Maine — Middle school math classes have worked in much the same way for decades. Teachers send students home with a textbook and a set of problems. Students work out the solutions on paper and bring the answers in the next day.

Teachers then spend a good chunk of the class reviewing the answers with students and explaining the solutions wherever students went wrong.

That changed this year at about 40 Maine schools, where students, mostly seventh-graders, are testing out a new way of crunching numbers for class. They use a computer program that gives students automatic feedback on homework answers by telling them whether they’re right or wrong and updates the teachers on their progress.

Neil Heffernan, a gregarious, lanky Worcester Polytechnic Institute computer science professor with a penchant for math and educational data-mining, started development of the program, called ASSISTments, eight years ago with the support of his wife, Cristina, a math teacher in Worcester, Mass.

ASSISTments hatched as an idea to help students practice math skills but has grown into an immense database of textbook questions used by students across the nation and in countries such as the United Kingdom and Japan. Throughout the process, Heffernan and others working on the project have visited schools across the country that are using the program.

On Tuesday, Heffernan and Andrew Burnett, who trains teachers to use the program, visited the William S. Cohen School in Bangor and schools in Hermon and Ellsworth to meet with teachers and administrators to gauge their feelings on the program.

At Cohen school, the duo from ASSISTMENTS sat down with Principal Gary Gonyar, two math teachers and representatives from the University of Maine’s Center for Research and Evaluation, which is assisting in an efficacy study of ASSISTments funded by a $3.5 million U.S. Department of Education grant.

“I see teachers very excited about what we have now and the potential for expanding student achievement in the future,” Gonyar said.

Using ASSISTments, the student goes through assigned questions in sequence, working out the solutions on a sheet of paper and entering the answers into the computer. If the student gets the right answer, the program moves to the next question. If the answer is wrong, the program tells the student to try again. If the student struggles with the question or gets stuck, he or she can ask for a series of hints that will lead to the right answer.

Before students come to class the next day, teachers can look at a table, which shows whether the students got the answer correct and whether they requested hints to get to the answer. The table also breaks the statistics down into percentages. If 95 percent of the class gets a question right, there’s little need to spend time on it in class, but if only 25 percent get it right, the teacher might decide to review that topic. The program also tells teachers how long it’s taking students to complete their assignments.

“We don’t shop the same way we did 30 years ago. We don’t communicate the same way we did. So why do we teach students the same way?” Heffernan said during his Cohen School visit Tuesday.

Cohen School math teacher Terrence Tibbetts said the program requires some getting used to and leads to more preparation time before classes, but said he believes it will pay off in instruction.

“In our school, the math teachers are all working very well together and collaborating on this,” Tibbetts said. “It’s a big change compared to the way we were teaching before.”

“You always have numbers to look at, you always have percentages to look at,” Tibbetts said, adding that it’s valuable to have “concrete evidence” of how well students are understanding what they’re learning.

He said he had a couple of suggestions for improvements to the program. His students sometimes complain that if you accidentally click a button, there’s no going back.

Heffernan said his goal is to evolve ASSISTments into something like Wikipedia, a website that allows users to post their own encyclopedia-like entries about people, places and things. Instead of creating a database of biographies, historical information and articles, ASSISTments users will help build an expansive bank of textbook questions, which teachers will dip into to select assignments. Only teachers and educational institutions, such as textbook producer Pearson, will have access to add to or alter ASSISTments entries.

Maine is prime territory for ASSISTments thanks to the laptop program started by former Gov. Angus King, now senator-elect, Heffernan said.

However, Heffernan added, the laptops should allow students to do more than research and make PowerPoint presentations. The laptop is just a tool, he said, and schools need practical uses and programs to make them valuable for students.

There are similar homework and tutoring programs available, but ASSISTments is unique in that Heffernan provides it for free.

Heffernan’s program was born from near disaster. In 1998, Heffernan had a seizure. A brain scan revealed a brain tumor and doctors gave Heffernan two to three years to live.

During that time, Heffernan had been working with his brother-in-law on a Web startup that was poised to make a lot of money. After hearing his diagnosis, Heffernan decided money “didn’t matter anymore” and left the startup.

The company he left eventually sold for $15 million. Heffernan’s cancer went away with treatment, and he earned a doctorate degree, which led to the creation of ASSISTments.

“We’re all about accelerating the learning of all kids,” Heffernan said.

Bangor school Superintendent Betsy Webb said earlier this week that she has been pleased with the decision to bring ASSISTments into Bangor middle schools.

“Students are really finding it helpful, and when we think about how humans learn, immediate feedback is so much more valuable,” Webb said.

She said ASSISTments is a prime example of “formative assessment,” which allows teachers to observe student performance and adjust their teaching plan or techniques to help students better retain the material.

“Even if one student struggles, that’s one too many,” Webb said.

The ASSISTments program has been featured in news media across the country, including The Boston Globe and New York Times, which ran the Web story with the headline “The machines are taking over.”

The lengthy Times piece highlights the story of ASSISTments, but the headline was wrong, Heffernan said.

Heffernan argues that ASSISTments doesn’t restrict the role of the teacher, but rather it crunches numbers and presents statistics so teachers can do what they’re trained to do — teach.

“Computers are good at what computers are good at. Teachers are good at what teachers are good at,” Heffernan said.