That making a huge list so you can just repeat the op a lot is a bit... Unconventional, to say the least. Can't you modulo the number to save space and not have to unnecessarily use so much space?
originally i had it doing something else but after like 2 hours of being stuck on this problem i just went for the dirty fix bc this problem made me want to bang my head against the wall. i have ideas of how to optimize it, however i just wanted to move on lol