#Сongruent-number-generator-hack
2.3 Взлом линейного конгруэнтного генератора чисел. Реализация алгоритма вычисления последующего числа по четырем предыдущим. Считать параметр m не более 65535. Например, есть 4 числа : 157; 5054; 25789; 13214 Следующим за этими числами будет число 16605
Решение:
Hardware: i5-10300H
OS: Ubuntu 18.04
Compiler: CMake 3.8
Файлы: "LinearCongruentMethod.cpp", "LinearCongruentMethod.h"
Основываясь на выражении (1), мы ищем таким образом кратное параметру m. Далее перебором всех множителей в диапазоне от MAX(x0, x1, x2, x3) до 65535 мы получаем значения параметров a и c. Если у нас получается u равное 0 (выражение (2)), то m любое значение от MAX(x0, x1, x2, x3) до 65535. Возможных решение большое множество. Выбираем с наименьшим значением m = MAX(x0, x1, x2, x3) + 1.
Литература: