Post History
Pyth, 8 bytes qu/Red._ Try it online! A list is in a loop if and only if it is the first list seen twice as f is applied repeatedly. qu/Red._ u Apply the following function, ...
#1: Initial revision
# [Pyth], 8 bytes
qu/Red._
[Try it online!][TIO-ltauip7o]
A list is in a loop if and only if it is the first list seen twice as f is applied repeatedly.
qu/Red._
u Apply the following function,
until a list is seen twice.
._ Take all prefixes of the list
/R Count the number of appearance of
ed The last element of the prefix
q Check if the first repeated is the input
[Pyth]: https://github.com/isaacg1/pyth
[TIO-ltauip7o]: https://tio.run/##K6gsyfj/v7BUPyg1RS/@//9oQx1DHSMgNNYxjgUA "Pyth – Try It Online"
