Post History
Pyth, 16 bytes .^RtJ^2yTyJ%2S97 Try it online! This solution uses Euler's formula, which states that if a is coprime to m, a^(phi(m)-1) = a^-1 mod m where phi(m) is the totient function, t...
Answer
#1: Initial revision
# [Pyth], 16 bytes .^RtJ^2yTyJ%2S97 [Try it online!][TIO-lt94lmtp] This solution uses [Euler's formula](https://en.wikipedia.org/wiki/Modular_multiplicative_inverse#Using_Euler's_theorem), which states that if a is coprime to m, a^(phi(m)-1) = a^-1 mod m where phi(m) is the totient function, the number of integers in the range [1, m-1] that are coprime to m. For a power of 2, this is m/2. Using this formula, I calculate the modular inverse of the odd numbers 1-97 with the modulus 2^21, because it makes the code shorter. .^RtJ^2yTyJ%2S97 S97 Generate the list 1, 2, ..., 97 %2 Take every other number, the odd ones. .^R Map the modular exponentiation function over the list, with the odd numbers as the base J^2yT Calculate 2^20 and save it in J. t Exponent of J-1 yJ Modulus of 2*J [Pyth]: https://github.com/isaacg1/pyth [TIO-lt94lmtp]: https://tio.run/##K6gsyfj/Xy8uqMQrzqgypNJL1SjY0vz//3/5BSWZ@XnF/3VTAA "Pyth – Try It Online"