We are actually given the code which decrypts the ciphertext and prints the flag. However, the code is extremely slow since the cipher involves perfect numbers and the code is trying to find them first. We can manually supply a list of perfect numbers in order to fully decrypt the ciphertext and get the flag.
Check out the original writeup for a detailed explanation.