Post History
Haskell, 24 bytes Probably the optimal solution. Credits go to nimi from PPCG. f n=elem n$map(^2)[0..n] Try it online! My original solution, 25 bytes f a=any((==a).(^2))[0..a] Try it ...
Answer
#3: Post edited
- # [Haskell], 24 bytes
Probably the optimal solution. Credits go to [nimi](https://codegolf.stackexchange.com/users/34531/nimi) from [PPCG](https://codegolf.stackexchange.com/).- <!-- language-all: lang-hs -->
- f n=elem n$map(^2)[0..n]
- [Try it online!][TIO-ks0757yf]
- [Haskell]: https://www.haskell.org/
- [TIO-ks0757yf]: https://tio.run/##y0gszk7Nyfn/P00hzzY1JzVXIU8lN7FAI85IM9pATy8v9n9JanFJsYKtQrSBjoKhjoKZiY6ChQWQaWQcy5WbmJkHlAJq8FXQKCjKzCtR0FNI01QA6/kPAA "Haskell – Try It Online"
- ### My original solution, 25 bytes
- <!-- language-all: lang-hs -->
- f a=any((==a).(^2))[0..a]
- [Try it online!][TIO-kryvbdgj]
- [Haskell]: https://www.haskell.org/
- [TIO-kryvbdgj]: https://tio.run/##y0gszk7Nyfn/P00h0TYxr1JDw9Y2UVNPI85IUzPaQE8vMfZ/SWpxSbGCrUK0gY6CoY6CmYmOgoUFkGlkHMuVm5iZB5TKTSzwVdAoKMrMK1HQU0jTVADr@Q8A "Haskell – Try It Online"
- # [Haskell], 24 bytes
- Probably the optimal solution. Credits go to [nimi](https://codegolf.stackexchange.com/a/125314) from [PPCG](https://codegolf.stackexchange.com/).
- <!-- language-all: lang-hs -->
- f n=elem n$map(^2)[0..n]
- [Try it online!][TIO-ks0757yf]
- [Haskell]: https://www.haskell.org/
- [TIO-ks0757yf]: https://tio.run/##y0gszk7Nyfn/P00hzzY1JzVXIU8lN7FAI85IM9pATy8v9n9JanFJsYKtQrSBjoKhjoKZiY6ChQWQaWQcy5WbmJkHlAJq8FXQKCjKzCtR0FNI01QA6/kPAA "Haskell – Try It Online"
- ### My original solution, 25 bytes
- <!-- language-all: lang-hs -->
- f a=any((==a).(^2))[0..a]
- [Try it online!][TIO-kryvbdgj]
- [Haskell]: https://www.haskell.org/
- [TIO-kryvbdgj]: https://tio.run/##y0gszk7Nyfn/P00h0TYxr1JDw9Y2UVNPI85IUzPaQE8vMfZ/SWpxSbGCrUK0gY6CoY6CmYmOgoUFkGlkHMuVm5iZB5TKTSzwVdAoKMrMK1HQU0jTVADr@Q8A "Haskell – Try It Online"
#2: Post edited
# [Haskell], 25 bytes- <!-- language-all: lang-hs -->
- f a=any((==a).(^2))[0..a]
- [Try it online!][TIO-kryvbdgj]
- [Haskell]: https://www.haskell.org/
- [TIO-kryvbdgj]: https://tio.run/##y0gszk7Nyfn/P00h0TYxr1JDw9Y2UVNPI85IUzPaQE8vMfZ/SWpxSbGCrUK0gY6CoY6CmYmOgoUFkGlkHMuVm5iZB5TKTSzwVdAoKMrMK1HQU0jTVADr@Q8A "Haskell – Try It Online"
- # [Haskell], 24 bytes
- Probably the optimal solution. Credits go to [nimi](https://codegolf.stackexchange.com/users/34531/nimi) from [PPCG](https://codegolf.stackexchange.com/).
- <!-- language-all: lang-hs -->
- f n=elem n$map(^2)[0..n]
- [Try it online!][TIO-ks0757yf]
- [Haskell]: https://www.haskell.org/
- [TIO-ks0757yf]: https://tio.run/##y0gszk7Nyfn/P00hzzY1JzVXIU8lN7FAI85IM9pATy8v9n9JanFJsYKtQrSBjoKhjoKZiY6ChQWQaWQcy5WbmJkHlAJq8FXQKCjKzCtR0FNI01QA6/kPAA "Haskell – Try It Online"
- ### My original solution, 25 bytes
- <!-- language-all: lang-hs -->
- f a=any((==a).(^2))[0..a]
- [Try it online!][TIO-kryvbdgj]
- [Haskell]: https://www.haskell.org/
- [TIO-kryvbdgj]: https://tio.run/##y0gszk7Nyfn/P00h0TYxr1JDw9Y2UVNPI85IUzPaQE8vMfZ/SWpxSbGCrUK0gY6CoY6CmYmOgoUFkGlkHMuVm5iZB5TKTSzwVdAoKMrMK1HQU0jTVADr@Q8A "Haskell – Try It Online"
#1: Initial revision
# [Haskell], 25 bytes <!-- language-all: lang-hs --> f a=any((==a).(^2))[0..a] [Try it online!][TIO-kryvbdgj] [Haskell]: https://www.haskell.org/ [TIO-kryvbdgj]: https://tio.run/##y0gszk7Nyfn/P00h0TYxr1JDw9Y2UVNPI85IUzPaQE8vMfZ/SWpxSbGCrUK0gY6CoY6CmYmOgoUFkGlkHMuVm5iZB5TKTSzwVdAoKMrMK1HQU0jTVADr@Q8A "Haskell – Try It Online"