Advent of code 2018/21
Ajax Direct

Answer

Part 1 :
Part 2 :
// See notes.php for the reverse engineering.
// Compute first 15000 values that would work for register 0.
$r0 = [];
$r1 = $r2 = 0;
for ($i = 0; $i <= 15000; $i++) {
    $r2 = $r1 | 65536;
    $r1 = 7902108;
    while (true) {
        $r1 = ((($r1 + ($r2 & 255)) & 16777215) * 65899) & 16777215;
        if ($r2 < 256) break;
        $r2 /= 256;
    }
    $r0[] = $r1;
}

// ==================================================
// > PART 1 : The first value that would work
// ==================================================
$solution_1 = $r0[0];

// ==================================================
// > PART 2 : The last value before previously encountered ones start to reapear
// ==================================================
$solution_2 = set($r0)->remove(set($r0)->duplicates())->last();