Post History
Husk, 11 10 bytes U¡λ⌊^+.%2¹ Try it online! This can probably be trivially ported to Jelly. Explanation U¡o⌊Ṡ^o+.%2 ¡ iterate over the input infinitely, creating a list o ...
Answer
#3: Post edited
# [Husk], 11 bytesU¡o⌊Ṡ^o+.%2[Try it online!][TIO-kob3dnyf]- [Husk]: https://github.com/barbuz/Husk
[TIO-kob3dnyf]: https://tio.run/##yygtzv7/P/TQwvxHPV0Pdy6Iy9fWUzX6//@/MQA "Husk – Try It Online"- This can probably be trivially ported to Jelly.
- ## Explanation
- ```
- U¡o⌊Ṡ^o+.%2
- ¡ iterate over the input infinitely, creating a list
- o with the following two functions:
- Ṡ^ take the previous result to the power
- %2 result modulo 2
- +. + 1/2
- ⌊ floor it
- U longest unique prefix
- # [Husk], <sup><del>11</del></sup> 10 bytes
- U¡λ⌊^+.%2¹
- [Try it online!][TIO-kojn6zfm]
- [Husk]: https://github.com/barbuz/Husk
- [TIO-kojn6zfm]: https://tio.run/##yygtzv7/P/TQwnO7H/V0xWnrqRod2vn//39jAA "Husk – Try It Online"
- This can probably be trivially ported to Jelly.
- ## Explanation
- ```
- U¡o⌊Ṡ^o+.%2
- ¡ iterate over the input infinitely, creating a list
- o with the following two functions:
- Ṡ^ take the previous result to the power
- %2 result modulo 2
- +. + 1/2
- ⌊ floor it
- U longest unique prefix
#2: Post edited
- # [Husk], 11 bytes
- U¡o⌊Ṡ^o+.%2
- [Try it online!][TIO-kob3dnyf]
- [Husk]: https://github.com/barbuz/Husk
- [TIO-kob3dnyf]: https://tio.run/##yygtzv7/P/TQwvxHPV0Pdy6Iy9fWUzX6//@/MQA "Husk – Try It Online"
- ## Explanation
- ```
- U¡o⌊Ṡ^o+.%2
- ¡ iterate over the input infinitely, creating a list
- o with the following two functions:
- Ṡ^ take the previous result to the power
- %2 result modulo 2
- +. + 1/2
- ⌊ floor it
- U longest unique prefix
- # [Husk], 11 bytes
- U¡o⌊Ṡ^o+.%2
- [Try it online!][TIO-kob3dnyf]
- [Husk]: https://github.com/barbuz/Husk
- [TIO-kob3dnyf]: https://tio.run/##yygtzv7/P/TQwvxHPV0Pdy6Iy9fWUzX6//@/MQA "Husk – Try It Online"
- This can probably be trivially ported to Jelly.
- ## Explanation
- ```
- U¡o⌊Ṡ^o+.%2
- ¡ iterate over the input infinitely, creating a list
- o with the following two functions:
- Ṡ^ take the previous result to the power
- %2 result modulo 2
- +. + 1/2
- ⌊ floor it
- U longest unique prefix
#1: Initial revision
# [Husk], 11 bytes U¡o⌊Ṡ^o+.%2 [Try it online!][TIO-kob3dnyf] [Husk]: https://github.com/barbuz/Husk [TIO-kob3dnyf]: https://tio.run/##yygtzv7/P/TQwvxHPV0Pdy6Iy9fWUzX6//@/MQA "Husk – Try It Online" ## Explanation ``` U¡o⌊Ṡ^o+.%2 ¡ iterate over the input infinitely, creating a list o with the following two functions: Ṡ^ take the previous result to the power %2 result modulo 2 +. + 1/2 ⌊ floor it U longest unique prefix