This year's exam grades were "almost derailed by a mutant algorithm", the prime minister has said.
Addressing students at an East Midlands school this afternoon, Boris Johnson said: "You couldn't sit your exams, which you yearned to do.
"And I'm afraid your grades were almost derailed by a mutant algorithm.
Exams crisis: U-turn will mean A-level and GCSE teacher grades stand
A levels 2020: Grades 'utterly unfair and unfathomable'
"And I know how stressful that must have been for pupils up and down the country. And I am very, very glad that it's finally been sorted out."
Mr Johnson also thanked pupils for their efforts to limit the spread of coronavirus.
"We have the number of deaths way down, we have the number of hospital admissions way, way down and it's thanks to you and your sacrifice that we have protected the NHS and saved literally tens of thousands, if not hundreds of thousands, of lives," he said.
"No previous generation of pupils has ever done anything like this."
Now, he said, "the risk to your health is not from Covid because, after all, statistically speaking, your chances of suffering from that disease are very, very low".
"The greatest risk you face now is of continuing to be out of school," he added.
WATCH: Boris Johnson says grades were 'almost derailed by a mutant algorithm'
Commenting on Mr Johnson's statement, Kevin Courtney, joint general secretary of the National Education Union, said: "It is brazen of the prime minister to idly shrug away a disaster that his own government created.
"Parents, students, teachers and heads will be horrified to see the leader of this country treat his own exams fiasco like some minor passing fad. The public will not easily forget the emotional rollercoaster of this year's results season. It is certain to put a long-lasting dent in the government's reputation on education.
"[Ofqual chief] Sally Collier fell on her sword yesterday, but the disaster of this year's exams model has its origins in a decade of Conservative education policy.
"Kenneth Baker and Justine Greening both agree the current system is not fit for purpose, and the NEU goes further. It needs ripping up, and for students entering exams next summer we need quick and decisive action."
The union is calling for a reduction in content-assessed in exams next summer, collaboration with the profession to develop a robust national system of moderated centre-assessed grades in case of further outbreaks of Covid-19, and a thorough independent review into assessment methods along the lines announced for Scotland.