Sequences¶
Writeup de Arnold-26, repris avec son autorisation. Source :
cylab-academy-writeups— challenge #297, résolu le 2026-11-24. Flags tronqués.
Catégorie : Cryptography · Challenge : #297 · Résolu le : 2026-11-24
Énoncé¶
I wrote this linear recurrence function, can you figure out how to make it run fast enough and get the flag? Download the code here sequences.py
Note that even an efficient solution might take several seconds to run. If your solution is taking several minutes, then you may need to reconsider your approach.
Résolution¶
Méthode : exponentiation matricielle.
La fonction est une recurrence lineaire d'ordre 4 ; calculer m(2e7) par memoisation explose la pile. On utilise la matrice compagnon 4x4 et l'exponentiation rapide modulo 10^10000 (O(log n) multiplications). Le MD5 du resultat valide la réponse, puis la clé SHA-256 déchiffre le flag.