misc/subtraction

448 points

Writeup by Aryan

This is the source code we are provided with.

import random

n = 696969

a = []
for i in range(n):
    a.append(random.randint(0, n))
    a[i] -= a[i] % 2

print(' '.join(list(map(str, a))))

for turns in range(20):
    c = int(input())
    for i in range(n):
        a[i] = abs(c - a[i])

    if len(set(a)) == 1:
        print(open('/flag.txt', 'r').read())
        break

If we keep subtracting by the mean of the dataset, the numbers will eventually all equal each other. The proof is left as an exercise to the reader.

Flag: n00bz{1_sh0uld_t34ch_my_br0th3r_logs_e18be9bd2874}

Last updated