Олимпиадный тренинг

Задача 39199. Integer Divisors


Задача

Темы: ЕГЭ
Let M – the sum of 5 of the maximum non-trivial divisors of an integer (not counting one and the number itself). If the number does not have 5 non-trivial divisors, then the M value is considered equal to zero.
Write a program that iterates over integers greater than  20 ​​000 000, in ascending order and looks among them for those for which the value M > 20 000 000 and the sum of the number formed by 3, 2 and 1 digits of M and the number formed by 6, 5 and 4 digits of M is a multiple of 5 (digits are counted from the end of the number, starting from 1).
For example,  with М = 12345678 the number formed by 3, 2 and 1 digits -  678, the number formed by 6, 5 and 4 digits - 345.
Print the first five found numbers and their corresponding values ​​M

Output format: for each of the five such found numbers in a separate line, the number itself is displayed first, then – value M (separated by one space). Lines are displayed in ascending order of found numbers.