[Question]
      [
A completely even number is a positive even integer whose divisors (not including 1) are all even.
Some completely even numbers are:
* 2 (divisors: 2, 1)
* 4 (divisors: 4, 2, 1)
* 16 (divisors: 16, 8, 4, 2, 1)
* 128 (divisors: 128, 64, 32, 16, 8, 4, 2, 1).
Some *non*-completely even numbers are:
* 10 (divisors: 10, 5, 2, 1)
* 12 (divisors: 12, 6, 4, 3, 2, 1)
* 14 (divisors: 14, 7, 2, 1)
* 18 (divisors: 18, 9, 6, 3, 2, 1)
* 1, being odd, is not completely even.
0 is not completely even (it's divisible by all positive integers, including odd numbers) but you **do not** need to handle this.
Your challenge is to take a positive integer as input and output a truthy value if it is completely even and a falsy value if it is not. These outputs do not need to be consistent.
If your solution doesn't return a falsy value for 0, it's encouraged to show what changes would be necessary to make it do so. Especially encouraged is to **show how your solution differs from checking if the input is a power of 2**; in some languages it may be shorter, and in some longer.
Input may be taken via any allowed method, and output may be given via any allowed method.
The shortest code in bytes wins!

[Answer]
# [MATL](https://github.com/lmendo/MATL), 2 bytes
```
qB
```
[Try it online!](https://tio.run/##y00syfn/v9Dp/39DAA "MATL ‚Äì Try It Online")
### How it works
This takes advantage of MATL's convenient interpretation of truthy and falsy. `q` decrements the input and `B` gets the binary representation of the result. This yields a non-empty array of **1**'s (truthy) for even powers of two, an array that is either empty of contains a **0** (falsy) otherwise.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
```
√ìg
```
[Try it online!](https://tio.run/##MzBNTDJM/f//8OT0//8NAQ "05AB1E ‚Äì Try It Online")
In 05AB1E only `1` is truthy. Input-`1`-and-input-`0`-verified.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
^‚Äô>
```
[Try it online!](https://tio.run/##y0rNyan8/z/uUcNMu/8GRYYGBgYKh9sPT0hTiFR4uGP7o4Y5Cj6ZxSXFCok5OQrJ@bkFOaklqTmVCqllqXkKeaW5SalFxQpJqSXlqUC@gUJiXooCyAy9/wA "Jelly ‚Äì Try It Online")
### How it works
```
^‚Äô>  Main link. Argument: n
 ‚Äô   Decrement; yield n-1.
^    Compute the bitwise XOR of n and n-1.
     This will conserve the highest set bit of n only if n is a power of two.
     If n is even, n-1 will be positive and the result will be different from n.
  >  Test if the result is larger than n.
```
[Answer]
# [Python 3](https://docs.python.org/3/), 16 bytes
```
lambda n:n^n-1>n
```
Returns *True* or *False*.
[Try it online!](https://tio.run/##K6gsycjPM/5fUJSZV6KhlZaZU5JapPE/JzE3KSVRIc8qLy5P19Au77@OQlFiXnqqhqGBgYGmpuZ/AA "Python 3 ‚Äì Try It Online")
### How it works
* If **n = 0**, then **n ‚äï (n - 1) = 0 ‚äï -1 = -1 < 0 = n**, so the function returns *False*.
* If **n = 1**, then **n ‚äï (n - 1) = 1 ‚äï 0 = 1 = n**, so the function returns *False*.
* If **2k < n < 2k+1**, then **2k ‚â§ n - 1 < 2k+1**, so **n** and **n - 1** have the **2k** bit in common,
**n ‚äï (n - 1) < 2k < n**, and the function returns *False*.
* Finally, if **n = 2k** with **k > 0**, then **n = 2k** and **n - 1 = 2k - 1** have no bits in common, so
**n ‚äï (n - 1) = n + (n - 1) > n + 0 = n** and the function returns *True*.
[Answer]
# Regex (ECMAScript or better), 17 bytes
`^((x+)(?=\2$))+x$` - Completely even
Takes its input in unary, as a string of `x` characters whose length represents the number.
**[Try it online!](https://tio.run/##Tc89b8IwFIXhv0IjBPeSJiQIdcA1TB1YGNqxtJIVLs5tjWPZBlI@fnsKQ6XOz5GO3i91UKHy7GIWHG/I7xr7TT@dl5aOvVfSL60DOMn5eNR9ArQpwkKuJ33EtO13o/EJ89i8Rc9WA@bBcEXw9JhNEUWQhTjWbAjASE9qY9gSID5IuzcGz1qaPDjDEYbZEAVvAazUuSGrY43zyeXCYaVWwNIpH2hpI@j34gPxD@g/2Hm5KGd3xlj75pgs7UEZ3vS8sppmvSQ1Ytt4EPwsSXCa4u0waZPckyMVgTHfqVjV4BHPYTBwt6QI94pSuH0M0d8m4nrtimxaFsUv "JavaScript (SpiderMonkey) ‚Äì Try It Online") - ECMAScript
[Try it online!](https://tio.run/##TY5Na8JAEIb/igRhZ4hZEunJ7eqpBy8e2mNtcUnGOCXdpLOrBtTfnsZCwdsLz/v15U4ulMJdzHxb0RBsbsS@Uv3Sd/AWhX2txZ13wydAnyKs7HY@RUz76bDToeGSoJhlBaIR@jmyECghVzXsSaEuRx1p7SPJ3o3WC/vuGBedtCWFoEOs2N9Qtx7UX2LW2OWlto0OXcMRVKbQ8B7A21o35Ot4wOX8euWwcRtg2zkJ93ao3/MPxH9Aj8Avi1WxuGOMB2nPydqfXMPVRJyvaTFJ0sbsWwHDz5YMpymOg0mfaKFuPA@M@tvF8gCCeHk43h6jPgtHAggrtfVqoRSmjCbYwtxuOOTZU5Hnvw "JavaScript (Node.js) ‚Äì Try It Online") - ECMAScript 2018**
[Try it online!](https://tio.run/##bVLbbtswDH3vV3BGh0i5qE6xp6lGsQ0bMGDthvYxzQDFlhOlMu1JcuOm6LdnlONdCtQvNMmjQ50jbtWDmm2L@4OpmtoF2FIuTC3GEv6vtMHYV2tOr3VHnZOmXVmTQ26V93ClDMITDDUfVKDwUJsCKuqw2@AMrkG5tV8sOYSNq3cePne5boKp6eQJwBdjNZQZ6l3/yxKR14UW1E@4/NiWpXa6uNGq0A5WPexlkf05OaQl53KY66dB7jaRnzGfrUiDKr4Z1IzzNxm21nJTMi/0r1ZZz5Kz8XiccP70EnpkYCy8SvBEDOEvAxGcEcOKcPfST7LRHY5iDPL5WHv@oULQDsFlwx@prZo4wHNJbqzq2mqFsM9KYtQSbnOFSNINNm2ADKLaocZuH33QlTDIJQw6e5jYKH@tu0DX7C0GGAyxdHfiOIKQEIPEob9YgqV2RAnfWBNYMqNHIHwATKnzFQOtgRONcl5TwuwiXfIp4PzVprAa12FzcQ6XEJHwnsJ8SYz5RrnFshv09BnOlxI@OKcevSiNtaybjrpRbwpAWbuoja6RYSoBLzKcU5hMSOCVCvmGHKqIzYnqmLF@c5EW/BORHzdG7Jxq2DAir5vH7@WNwrWmSekUOY9KS2AVjceCvItvu@eDyTU5tnMmaBYflct9Flwb3@dfuyEPQ8mStz4hS7h8jt9J3KrDT8a6CWeX2d35KeeT7vQQV@WQzt7N0/Q3 "Java (JDK) ‚Äì Try It Online") - Java
Remarkably, there are *three* completely different 17 byte solutions for Powers of 2, which blew my mind even when I thought there were two. For this challenge, only one is 17 bytes, but for plain Powers of 2 they all are.
---
`^(?!(x(xx)+)\1*$)` - **17 bytes** - Powers of 2
`^(?!(x(xx)+)\1*$)x` - **18 bytes** - Powers of 2, correct at zero
`^(?!(x(xx)+)\1*$)xx` - **19 bytes** - Completely even
| Regex engine | Powers of 2 | Completely even |
| --- | --- | --- |
| ECMAScript | [Try it online!](https://tio.run/##Tc/LbsIwEIXhV4GogpmkCUmFusA1rLpgw6Jd9iJZZHCmNY5lG0i5PHsKi0pdf0c6@r/UXoW1Zxfz4Lgmv23tN/30Xlo6DF5IP3cO4Cjnk7T/hMUQOug6zPC9Su@wTydHLGL7Gj1bDVgEw2uCx/t8iiiCLMWhYUMARnpStWFLgDiUdmcMnrQ0RXCGI4zzMQreAFipC0NWxwbnD@czh5VaAUunfKCljaDfyg/EP6D/YOfVoprdGGPj20OytHtluB54ZTXNBklmxKb1IPhJkuAsw@th0iWFJ0cqAmOxVXHdgEc8hdHIXZMi3Coq4XYxRH@diMulr/JpVZa/ "JavaScript (SpiderMonkey) ‚Äì Try It Online") | [Try it online!](https://tio.run/##Tc/LbsIwEIXhV4GoghnShKRCXeAaVl2wYdEue5EsGJxpjWPZBlwuz57ColLX35GO/i@1V2Hl2cUiOF6T37b2m346Ly0dei@kn5MDOMrZeNR9wrwPCVLCHN/r0R2m1I3GRyxj@xo9Ww1YBsMrgsf7YoIogqzEoWFDAEZ6UmvDlgCxL@3OGDxpacrgDEcYFkMUvAGwUpeGrI4Nzh7OZw5LtQSWTvlACxtBv1UfiH9A/8HO6nk9vTHGxreHbGH3yvC655XVNO1luRGb1oPgJ0mC8xyvh1nKSk@OVATGcqviqgGPeAqDgbsmRbhV1MLtYoj@OhGXS1cVk7qqfgE "JavaScript (SpiderMonkey) ‚Äì Try It Online") |
| Python | [Try it online!](https://tio.run/##NY7BTsMwEETv@YrF6mG3TaIscEqw@iEhSBW4rZFZR2ujpl@f1kXcRvP0RjNf8znKy@p/5qgZ0jXV6urvFGUAtWqMWT9w/4QLLgvt6J23G1rv7ch9w9MA3nbVMSoE8FLsNuUvL30FwYY2zcFnNI2hCvwRghMM9PbcQxh5smHspgqKLEXWg5wceslYANV/iSfaMd33yoC6NrmDfp5RazCL2cqDFOR7mLUo9CgsD/9v4m9uL@qzw5QVhWjl5pW77gY "Python 3 ‚Äì Try It Online") | [Try it online!](https://tio.run/##NY7BTsMwEETv@YrF6mG3TSIbOCVY/ZAQpArc1siso7VR3a9P6yJuo3l6o1mu@Rz5ZfU/S5QM6Zpace13ijyCWFFKrR@4f8KCpdCO3s12Q6Ws934yQ2fmEbzVzTEKBPBc/T7lL89DA8GGPi3BZ1Sdogb8EYJjDPT2PECYzGzDpOcGqsxVlgOfHHrOWAG1f8nMtDN036sD4vrkDvJ5RmlBFbXlB6nID7BIVehRWDP@v4m/ub@Izw5TFmSiVXevRusb "Python 3 ‚Äì Try It Online") |
| Ruby | [Try it online!](https://tio.run/##PY5BiwIxDIXv/oo4LNgqE1rZW7eI4F73IHsbtSjWsVDi0KnYvfjXZ1tRDwnk5X0vCdfD3xBAw9q2NnVI9gar5e8Sg90fFTgtFNzOzlvwurWxHwG4E/imllutqw1VKi98IxDr@VaBpWN2ZAX7zrvIJvWEPxH0ltp4Zvxrnpkm8xl7I6dLAAJHUESMF@OYFByxGN9j9j2yWJWqKXHQdwiqCG5c/uyusX/klb9lnoOjCPQ6UXopY75/VsYMO7YYs8RS4jO@kdMPPgyy/pRC/AM "Ruby ‚Äì Try It Online") | [Try it online!](https://tio.run/##PY5BiwIxDIXv/oo4LNgqE1rZW7eI4F73IHsbtSjWsVDi0KnYvfjXZ1tRDwnk5X0vCdfD3xBAw9q2NnVI9gar5e8Sg90fFTgtFNzOzlvwurWxHwG4E/imllutqw1VKi98IxDr@VaBpWN2ZAX7zrvIJvWEPxH0ltp4Zvxrnpkm8xl7I6dLAAJHUESMF@OYFByxGN9j9j2yWJWqKXHQdwiqCG5c/uyusX/klb9lnoOjCPQ6UXopY75/VsYMO7YYs8RS4jO@kdMPntIwiPpTCvEP "Ruby ‚Äì Try It Online") |
This is what I came up to solve a level of [Regex Golf](https://alf.nu/RegexGolf) on 2014-02-21, and was also independently discovered by several others, including earlier than 2013-12-20. It's the one most similar to the well-known [primality test](https://codegolf.stackexchange.com/questions/57617/is-this-number-a-prime/177196#177196), which is probably why most people came up with this one instead of the others.
It asserts that \$n\$ has no odd divisors of \$3\$ or greater yielding a positive quotient. It has a false positive for zero, since although zero can be divided by any odd number, the quotient is zero, not positive. This can be fixed at the cost of an extra byte: `^(?!(x(xx)+|)\1*$)` or `^(?!(x(xx)+)\1*$)x`.
Since the entire test is inside a (negative) lookahead, it can be adapted to answer this challenge by adding `xx` at the end, which enforces that only \$n‚â•2\$ can match.
---
`^(?!(x*)(\1\1)+$)` - **17 bytes** - Powers of 2
`^(?!(x*)(\1\1)+$)xx` - **19 bytes** - Completely even
| Regex engine | Powers of 2 | Completely even |
| --- | --- | --- |
| ECMAScript | [Try it online!](https://tio.run/##Tc/LbsIwEIXhVwlRBTNJE5IKdYFrWHXBhkW7LK1kweBMaxzLNpdyefYUFpVYf0c6@r/VToWlZxeL4HhFftPaH/rtvLS0T95Ivx4cwFFOhln3BdMeHDKERb2oMX/ALhsesYzte/RsNWAZDC8Jnh@LEaIIshL7hg0BGOlJrQxbAsSetFtj8KSlKYMzHGFQDFDwGsBKXRqyOjY4eTqfOczVHFg65QPNbAT9UX0i/gPdg53U03p8Y4yNb/fpzO6U4VXildU0TtLciHXrQfCLJMF5jtfD9JCWnhypCIzlRsVlAx7xFPp9d02KcKuohdvGEP11Ii6XripGdVX9AQ "JavaScript (SpiderMonkey) ‚Äì Try It Online") | [Try it online!](https://tio.run/##TY5PT8IwGMa/ChKTvq9jzWo8rRZOHrhw0KNoaLaX8ZrazbbAEuCzz2Fiwu1Jfs@/L3uwsQrcpdy3NQ3RFDqYV2pe@g7eUmDfyGCPm@ETFnfQPyCs1Vphdo99P2xkdFwRqFmuEHWgnz0HAhHI1o49CZTVqBMtfaKwtaP1xL7bp7ILbUUxyphq9heUrQfxl5g5Mz81xsnYOU4gcoGatwDeNNKRb9IO54/nM8eVXQGbzoZ4bYfmvfhA/Ad0C/xcLVR5xZh2oT1Ol/5gHdeTYH1D5WSaOb1tA2h@NqQ5y3AcnPZTGagbzwOj/Lap2kFAPN0cb/dJHgMnAogLsfaiFAIzRh2N0pcLDkX@pIriFw "JavaScript (Node.js) ‚Äì Try It Online") |
| Python | [Try it online!](https://tio.run/##NY7BTsMwEETv@YrF4rDbJpFdbglWPyQNUgUuXWTW0doV7deHuojbaJ7eaJZbOSd5Wfl7SVog33Krof3KSUZQr8aY9Q33T3jdEB7cwdH2mdZ7O7mhc/MI7G1zSgoRWKrd5/LBMjQQfezzErmg6Qw1wCeIQTDS626AOLnZx8nODVRZqqxH@QzIUrACav@Sm2nr6L5XBzT0ORz1/YzagrmajTxIRTzAolWhR@Hd@P8mXUr/o1wC5qIoRKvtds7aXw "Python 3 ‚Äì Try It Online") | [Try it online!](https://tio.run/##NY7BTsMwEETv@YrF4rDbJpFdbgkWH5IGqQKXLjLraG1E@vWhLuI2mqc3muVaLkmeNv5akhbI19xqaD9zkhHUqzFme8WXB1x3hEd3dLR/pHXdbv3khs7NI7C3zTkpRGCpfp/LO8vQQPSxz0vkgqYz1ACfIQbBSM@HAeLkZh8nOzdQZamynuQjIEvBCqj9S26mvaPbXh3Q0Odw0rcLagtmNTu5k4p4gEWrQvfCu/H/Tfou/Y9yCZiLohBttjs4a38B "Python 3 ‚Äì Try It Online") |
| Ruby | [Try it online!](https://tio.run/##PY5Bi8IwEIXv/oqxLJgoHZJes2ER9LqHxVurQWmsgTCWNGL34l/vJrJ6mIF58743E26n3ymAhh/b2bFHsnfYrHdrDPbYKnBaKLhfnLfgdWfjMANwZ/B1KfdaFw0VKi18LRDLaq/AUpscScGh9y6yRbng/wh6S128MP5ZJaZOfMLeyPkagMARZBHj1TgmBUfMxveYfM8sVozFkjjoBwSVBTfPf/a3ODzz8t8yzcFRBHqdyD2XMdvvjTHTgX3N2bjkrJGN5KsPPk2irKQQfw "Ruby ‚Äì Try It Online") | [Try it online!](https://tio.run/##PY5BawIxEIXv/RXjIpgoOyR7jUEEvXoove3aUDGugTAu2YjppX99m0jrYQbmzfveTLifvqcAGt5tb9OAZB@w235sMdivswKnhYLH1XkLXvc2jm8A7gK@reVR66qjSuWFbwVi3RwVWDpnR1ZwHLyLbFEv@B@C3lIfr4yvm8y0mc/YC7ncAhA4giJivBnHpOCIxfgas@@ZxapULYmD/oGgiuBm5c/hHsdnXvlb5jk4ikD/J0ovZcz@sDNm@mSbGUtLzjrZSb6a85SmSdSNFOIX "Ruby ‚Äì Try It Online") |
This was discovered by Grimmy in 2019-02-05, [without fanfare](https://chat.stackexchange.com/transcript/message/48931239#48931239). I on the other hand was amazed, as this has no such flaw as the other negative assertion ‚Äì it does not match zero.
It asserts that \$n\$ has no divisors yielding an odd quotient of \$3\$ or greater. As a negative assertion, it does not consume the power of 2 that it matches, and thus is great for use in larger regexes where it doesn't need to be wrapped in a lookahead to allow other tests to be done on the same value of \$tail\$.
The downside is that in standard regex engines, it's significantly slower than `^(?!(x(xx)+|)\1*$)`. In my regex engine though, they're both [statically optimized](https://github.com/Davidebyzero/RegexMathEngine/blob/master/matcher-optimization.h#L148) into a bitwise power of 2 test unless optimizations are disabled.
---
`^((x+)(?=\2$))*x$` - **17 bytes** - Powers of 2
`^((x+)(?=\2$))+x$` - **17 bytes** - Completely even
| Regex engine | Powers of 2 | Completely even |
| --- | --- | --- |
| ECMAScript | [Try it online!](https://tio.run/##Tc89b8IwFIXhv0IjBPeSJiQIdcA1TB1YGNqxtJIVLs5tjWPZBlI@fnsKQ6XOz5GO3i91UKHy7GIWHG/I7xr7TT@dl5aOvVfSL60DOMn5eNR9ArQpwkKuJ33EUdvvRuMT5rF5i56tBsyD4Yrg6TGbIoogC3Gs2RCAkZ7UxrAlQHyQdm8MnrU0eXCGIwyzIQreAlipc0NWxxrnk8uFw0qtgKVTPtDSRtDvxQfiH9B/sPNyUc7ujLH2zTFZ2oMyvOl5ZTXNeklqxLbxIPhZkuA0xdth0ia5J0cqAmO@U7GqwSOew2DgbkkR7hWlcPsYor9NxPXaFdm0LIpf "JavaScript (SpiderMonkey) ‚Äì Try It Online") | [Try it online!](https://tio.run/##Tc89b8IwFIXhv0IjBPeSJiQIdcA1TB1YGNqxtJIVLs5tjWPZBlI@fnsKQ6XOz5GO3i91UKHy7GIWHG/I7xr7TT@dl5aOvVfSL60DOMn5eNR9ArQpwkKuJ33EtO13o/EJ89i8Rc9WA@bBcEXw9JhNEUWQhTjWbAjASE9qY9gSID5IuzcGz1qaPDjDEYbZEAVvAazUuSGrY43zyeXCYaVWwNIpH2hpI@j34gPxD@g/2Hm5KGd3xlj75pgs7UEZ3vS8sppmvSQ1Ytt4EPwsSXCa4u0waZPckyMVgTHfqVjV4BHPYTBwt6QI94pSuH0M0d8m4nrtimxaFsUv "JavaScript (SpiderMonkey) ‚Äì Try It Online") |
| Python | [Try it online!](https://tio.run/##NY7BbsIwEETv@YqVxWEXkshOb0ktPiQECbWmGLnraG1E@PqAqXobzdMbzfzIl8gfq/@do2RIj1SLq68p8gBiRSm1HhGXHeHeHroN0XbZrK92NH1jpgG81dU5CgTwXOw25W/PfQXBhjbNwWdUjaIK/BmCYwz02fUQRjPZMOqpgiJzkeXEPw49ZyyA6r9kJtoZeu2VAXFtcif5uqDUoBa15TcpyPcwS1HoXVgz/L@Jt9zexWeHKQsy0aqbzmj9BA "Python 3 ‚Äì Try It Online") | [Try it online!](https://tio.run/##NY7NasMwEITvfopF5LBb/yC5N7uiD@I4EFqlUVFXZqUQ5@mdKKG3YT6@YZZbPkd@3/zfEiVDuqVGXPObIo8gVpRS2wFxrQk/7b7fEdXrbnu0kxlaM4/gra5OUSCA52J3KX97HioINnRpCT6jahVV4E8QHGOgj36AMJnZhknPFRSZiyxH/nHoOWMB1LySmak29NgrA@K65I7ydUZpQK3qjZ@kID/AIkWhZ2HN@P8mXnJ3FZ8dpizIRJtue6P1HQ "Python 3 ‚Äì Try It Online") |
| Ruby | [Try it online!](https://tio.run/##PY5BC8IwDIXv/oo4BFtlodu1FhH06kG8TS2KdRZKHF3FefGvz1bUQwJ5ed9L/P307D0o2JjadA2SecBysV2gN8ezBKuEhMfVOgNO1Sa0AwB7AVflxV6pbEeZjAtXCcS83EswdI6OqGDbOBvYOB/zL4LOUB2ujM/KyFSRj9gfudw8EFiCJGK4acsKwRGT8T9G3yeLZV02IQ7qBV4mwQ7Tn809tJ@89HcRZ28pAP1OpJ5K69V6qXV/YKybcjZXu3LE@aQb9b3Iy0KINw "Ruby ‚Äì Try It Online") | [Try it online!](https://tio.run/##PY5BC8IwDIXv/oo4BFtlodu1FhH06kG8TS2KdRZKHF3FefGvz1bUQwJ5ed9L/P307D0o2JjadA2SecBysV2gN8ezBKuEhMfVOgNO1Sa0AwB7AVflxV6pbEeZjAtXCcS83EswdI6OqGDbOBvYOB/zL4LOUB2ujM/KyFSRj9gfudw8EFiCJGK4acsKwRGT8T9G3yeLZV02IQ7qBV4mwQ7Tn809tJ@89HcRZ28pAP1OpJ5K69V6qXV/YKybcjZXu3LE@bQb9b3Iy0KINw "Ruby ‚Äì Try It Online") |
I discovered this one in 2014-02-21, after being mentally primed by solving teukon's Dominoes 2 puzzle (which is now included in [Regex Golf](https://alf.nu/RegexGolf)); teukon independently came up with it later that same day. It was the very first problem in unary that we solved by repeatedly decreasing \$tail\$ in a loop while retaining an invariant property at every step, and is probably the simplest function that is best golfed by being solved that way.
It repeatedly divides \$tail\$ by \$2\$ (asserting each time that there is no remainder) as many times as possible, and then asserts that the end result is \$1\$. This one is useful in larger regexes when it is desirable to consume the identified power of 2.
It is the most suitable for solving this challenge, ‚ÄúIs it a completely even number?‚Äù, as the only change necessary is upping the minimum iteration count of the loop from `0` to `1` by changing the `*` quantifier to a `+`, at a cost of 0 bytes. This enforces that \$n\$ must be evenly divided by \$2\$ at least once before yielding an end result of \$1\$.
[Answer]
# [Python 2](https://docs.python.org/2/), 18 bytes
```
lambda x:~-x&x<1<x
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUaHCqk63Qq3CxtCm4n9BUWZeiUKaRmZeQWmJhqbmf0MA "Python 2 ‚Äì Try It Online")
-3 thanks to [Rod](https://codegolf.stackexchange.com/users/47120/rod).
[Answer]
## JavaScript (ES6), 14 bytes
```
f=
n=>n>1>(n&n-1)
```
```
<input type=number min=0 oninput=o.textContent=f(this.value)><pre id=o>
```
Python doesn't have the monopoly on chained comparisons!
[Answer]
# [Husk](https://github.com/barbuz/Husk), 3 bytes
Returns `log‚ÇÇ(x)` if True `0` otherwise
```
¬£ƒ∞2
```
### Explanation
```
¬£       Is it an element of the increasing sequence
 ƒ∞2     powers of two (starting at 2)
```
[Try it online!](https://tio.run/##yygtzv7//9DiIxuM/v//b2hkAQA "Husk ‚Äì Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt/), 6 bytes
```
√µ!¬≤ √∏U
```
[Test it](https://ethproductions.github.io/japt/?v=1.4.5&code=9SGyIPhV&input=MQ==)
---
## Explanation
Generate an array of integers (`√µ`) from `1` to input `U`. Raise 2 to the power of each (`!¬≤`). Check if the array includes (`√∏`) `U`.
[Answer]
# [Python 2](https://docs.python.org/2/), 33 bytes
```
lambda n:bin(n).count('1')==1-n%2
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHPKikzTyNPUy85vzSvREPdUF3T1tZQN08VqCq/SCFTITNPoSgxLz1Vw9RA06qgKDOvRCFTJ00jU/M/AA "Python 2 ‚Äì Try It Online")
## Recusive approach, ~~38~~ 36 bytes
-2 bytes thanks to Leaky Nun
```
f=lambda n:n>1if n<3else f(~n%2*n/2)
```
[Try it online!](https://tio.run/##BcFBCoAgEAXQq8wm0Agqo41UdzFyasC@Ym7adHV7L73lijC18hrcvR@OYLGNwoRl8uHxxOpDY1r0RleOmYQElB1Or@ZB25QFhaRjJbr@ "Python 2 ‚Äì Try It Online")
[Answer]
# [Implicit](//git.io/sS), ~~7~~ ~~2~~ 3 bytes
```
¬Ω?√∂
```
[Try it online!](https://tio.run/##K87MLchJLS5JTM7@///QXvvD2/7/NwQA) Explanation:
```
     implicit float input
¬Ω    calculate log2(input)
 ?   if truthy
  √∂   push 1 if top-of-stack is whole, 0 if non-whole
     implicit int output
```
`¬Ω` pushes log2(input). If the input is `0` or `1` it will push `0.000000`. 0 is a whole number so performing `√∂` on 0 will yield 1, giving the incorrect result for the input 1. `?` only performs the next command if the top of stack is truthy. So if the input was 1 or 0, it will skip the `√∂` and print 0 as it's supposed to. Otherwise it will push 1 if `log2(input)` is whole and 0 if it's not.
[Answer]
# Regex ([Tcl ARE](https://www.tcl-lang.org/man/tcl/TclCmd/re_syntax.htm)), ~~24~~ 22 bytes
`^((x((xx)*))\2*$)\3` - **19 bytes** - Powers of 2 - [Try it online!](https://tio.run/##bVHbisIwEH33K46hD1YotC7sS7f7I5qFWscajGNJ4loo/fbutG5Flh3yMJk5l3ASKjt4CnDY@tveByR8ra6XS8kHP/b7sjp7W/oTTdfv0plyb@XSDV@rVSunjddxvNuso3j3NvQ6xywXnOEaruSaEDlk2FLbOHTzxhLX4SQrjQSbXuvFyDTIctxPxpIgawoePhwMw2osCyRZj24BqRFrrdg01gREFipRYm6OQrOztBXWJ9KZM/M4xdYaPlA7QpD@yysKjGYTPkPEokLW03PyqpDp/mlwvLpfzIPURYyPQvpRzXDlwK/vGWsyd1RLPkhE1VQSsESmniFSQ2WAmLFW@i99llhGRlbNTTJTqs8faaY5pol8HtNd3kxQEateakiT9zT9AQ "Tcl ‚Äì Try It Online")
`^(x$|(x((xx)*))\2*$)\3` - **22 bytes** - Completely even - [Try it online!](https://tio.run/##bVHLboMwELznKyaWDxAJCVKpF0p/JHElQjbEqmOQ7TRIlG@nCylRVHVP6915rMahMqOnAIedvx58QGKbqrlcSnv0U38oq09vSn@m@flVOl0eDD/68SPq5HfURVHXxZs43m83Mt6/jIPKsSgGp20NV9qaIB0y7KhrHfplY8jW4cwrhQTbQanVxNTIctzO2hAjawoePhy1hVFYF0iyAf0KXBPWGLZpjQ6QBiIRbK5PTDOLtGHWO9KFs/Bsip3R9kjdBEH6L68oMJnN@AzSsgoZT4/Js0KmhofBqXG/mDuplxZvBfeTmraVg32@Z6rZ3FHN@SBhVV1xxhyZeIRILZUBbGaVUH/pi8Raal61V85MiCG/p5nmmCf8f5ZufDNBSCsGrjFNXtP0Bw "Tcl ‚Äì Try It Online")
Tcl ARE has both positive and negative lookaheads, but neither backreferences nor captures can be done inside one. So seemingly, it would be impossible to match powers of 2 instead of non-powers, because all of the ECMAScript regexes use backreferences inside a lookahead. This challenge states "output a truthy value if it is completely even and a falsy value if it is not", so an inverted-logic regex, such as `^(x*)(\1\1)+$|^x$`, would not satisfy the rules.
But as it so happens, in Tcl ARE it seems that any group anchored on both sides (`^` at the beginning and `$` at the end, either inside or outside the group as long as it's adjacent to the parentheses) in all its alternatives will be treated as atomic (preventing the engine from doing the equivalent of backtracking into that expression if the pattern fails to match at a later point). This does not appear to be documented, but it can be exploited to emulate a negative match. The equivalent in engines that support atomic groups would be:
`^(?>(x((xx)*))\1*$)\2` - **21 bytes** - Powers of 2 - [Try it online!](https://tio.run/##XVBda8IwFH33V4QQaK6m2ha3IbHzZRsIYw/b3qwLtUttWU1DGqEg/vbuVva0h1zu1znn5tjKDuuNrSxhjqSELiiZE@v0UTltm7zQPFjMpxulqrzxqmhPtm60y3gGMntfdIEgAb4Sm@qoxwXjtfEdV@pl@/qsFAgSA1IisZzUplad9pzawun5IS9@vMOgmvpUeyoIXSar5er@IVndUZCTsnWc1WkkWZOWyN7xj8@n7RtIuJC65KzZdd412mAGYbxPU5oZCrjcnQ84wbaIRBjDiNe9bdpvzWlIBa5LxBft2fgRu04QtEMCjNFeTgi5KZu/mpl1eptjNpsBShN@c@iU@6LizAkUG@3SuedBHwhmAIBcxhNr0EXVjndJgl@JJRlrwoy8osz1n60c5PDFN4@857zvYQqQxVMGWTIMUZjEUfQL "PHP ‚Äì Try It Online")
`^(?>(x\B((xx)*))\1*$)\2` - **23 bytes** - Completely even - [Try it online!](https://tio.run/##XVBdS8MwFH3frwgh0Nyt3doylZHVgaggiA/q2zpDV9O1mKUhzaAw9tvr7fDJh1zu1znn5tjaDuuNrS1hjmSELiiZE@vUQTpldVEqHizm042UdaG9LNujbbRyOc9B5O@LLghJgK/CpjyoccF4ZXzHpXx@eX2SEkKSAFIisZg0ppGd8pza0qn5vih/vMMgdXNsPA0JXaar5er2Ll3dUBCTqnWcNVksmM4qZO/4x@fjyxsIOJOm4kxvO@@0MphBlOyyjOaGAi53pz1OsB3GYZTAiFe91e234jSiIa4LxJftyfgRu04RtEUCjPFOTAi5Kpu/mpl1dp1jNpsBShN@dehY@LLmzIUoNtqlCs@DPgiZAQByHk9sQJV1O94lCH4lEWSsCTPigjKXf7ZyEMMX39zzPn/gvO9hCpAnUwZ5OgxxlCZx/As "PHP ‚Äì Try It Online")
These in turn are based on the [17 byte ECMAScript regex](https://codegolf.stackexchange.com/a/222496/17216) `^(?!(x(xx)+)\1*$)`. The logic of the Tcl ARE version is to assert that the largest odd factor of \$n\$ is \$1\$. The "completely even" version additionally asserts than \$n\ne 1\$.
Even more strangely than the atomic grouping behavior, Tcl ARE apparently records the positions where word-boundary-match operators (`\m`, `\M`, `\y`, `\Y`) were used inside a capture group, and repeats them if that group is repeated via a backreference. So `^((x\Y((xx)*))\2*$)\3` (**21 bytes**) not only doesn't match \$1\$, but doesn't match \$2\$ either: [Try it online!](https://tio.run/##bVHLasMwELznKybChzhgsFPoxXX/oyQqOM7GEVU2RlIag/G3u2unDqF0D2K1Ow8xCpUdPAU4bP117wMSvlSX87nkgx/7fVl9eVv6E03X79KZcm/l0g2fq1W7@5CjjddxvNuso3j3MvQ6xywYnOEaruSaEDlk2FLbOHTzxhLX4SQrjQSbXuvFyDTIctxOxpIgawoePhwMw2osCyRZj24BqRFrrdg01gREFipRYm6OQrOztBXWO9KZM/M4xdYaPlA7QpD@yysKjGYTPkPEokLW02PyrJDp/mFwvLhfzJ3URYy3QvpRzXDlwM/vGWsyd1RLPkhE1VQSsUSmHiFSQ2WAmLFW@i99llhGRlbNVTJTqs/vaaY5pol8H9NN3kxQEateakiT1zT9AQ "Tcl ‚Äì Try It Online") ‚Äì and as a result, the 22 byte method has to be used instead.
Explanation for Powers of 2 (**19 bytes**):
```
^
(                  # Group an expression that is anchored to start at its
                   # beginning and to end at its end, thus telling the Tcl ARE
                   # regex engine to treat it as atomic, not backtracking into
                   # it if a subsequent match fails.
    (              # \2 = sum of the following, which will be the largest odd
                   #      number that results in a match for what follows:
        x          # 1; tail -= 1
        ((xx)*)    # \3 = any even number, including zero, trying the largest
                   #      values first; tail -= \3
    )
    \2*$           # Assert that \2 divides tail; anchor to end of string
)
\3                 # Now that the above match is locked in and won't backtrack,
                   # assert that \3 == 0, as no other value can match when
                   # tail == 0 (at the end of the string), thus asserting that
                   # \2 == 1, i.e. that the largest odd factor of N is 1.
```
For Completely even (**22 bytes**), an alternative of `x$` is inserted as the first choice. If \$n=1\$ and this alternative matches, it effectively acts like a boolean short-circuit operator ‚Äì the powers of 2 test won't be done, and `\3` will not be set.
An alternative method to match powers of 2 is `^((x+?)((\2\2)*$))\3` (**20 bytes**): [Try it online!](https://tio.run/##bVHbboJAEH33K44bHqANCeCjpf0Q3SaII266jmR3rSaEb6cDFmOaztPszLlMzobaDp4CHDb@svMBKZ/r8@lU8d6P/a6qv7yt/JGm53flTLWz8uiGzzi@vX4kcbwttkXyEiXJdjX0eo1ZLzjDDVzFDSFyyLGhW@vQzRtL3ISjrDRSFL3Wi5FpkK9xPRpLgmwoePiwNwyrsSyR5j26BaRGrLVi01oTEFmoVIm5OQjNztJWWO/IZs7M4wwba3hPtxGC7F9eWWI0m/A5IhYVsp4ek2eFXPcPg8PZ/WLupC5ivJXSj2qGawd@vmesydxRI/kgFVVTS8ISmXqESC1VAWLGWum/9FliGRlZtRfJTKl@fU8zW2OayO8xXeVmgopY9VJDlq6KHw "Tcl ‚Äì Try It Online") - this uses the same atomic grouping trick, but the logic is to assert that the smallest quotient from dividing \$n\$ by any odd number is \$n\$ (thus it's implied that the only odd divisor of \$n\$ is \$1\$). For "completely even" numbers this becomes `^(x$|(x+?)((\2\2)*$))\3` (**23 bytes**): [Try it online!](https://tio.run/##bVHLboMwELznKyaWD9AKCciR0n5I4kqEuMSqs0G20yBRvp0upERR1T2td@exGofajl4HOGz9Ze8DEjrX59OpooOf@n1Vf3pb@aOen1@VM9Xe8qMf36NOfkfd81scRbt8l8dPMo53m3FQBRbJ4Aw1cBU1GtIhw1Z3rUO/bKymJhx5pZAgH5RaTUyDrMD1aKxmZKODhw8HQ7AK6xJJNqBfgWvCWss2rTUB0kIkgs3NB9PsIm2Z9Yp04Sw8SrG1hg66myBI/@WVJSazGZ9BEqto6/V98qiQqeFu8HF2v5gbqZeEl5L7Sc1Q7UCP90w1mzvdcD5IWNXUHDJHJu4h6lZXAWxGSqi/9EViLQ2v2gtnJsRQ3NJMC8wT/kDSV75ZQ0gSA9eYJpv8Bw "Tcl ‚Äì Try It Online") But this method is much slower than the primary one shown in this answer, and Tcl cannot even match \$n=64\$ within 60 seconds.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
√Üf=2»¶
```
[Try it online!](https://tio.run/##y0rNyan8//9wW5qt0Yll////NwQA "Jelly ‚Äì Try It Online")
Does ***NOT*** fail for `1`!
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), ~~18~~ 16 bytes
```
i->i>1&(i&~-i)<1
```
[Try it online!](https://tio.run/##TY0xD4IwEIV3fsVNhBppwmYCMjiYODgxGocKlRyWtqFXEmLwr2MxDL7x3fe@68QoUmOl7prXgr01A0EXOk7YS77Lo//OEyr@9LomNHo9RrUSzsFVoIZ3BCGOBGEN5w0qLppkK4c9nIxRUugSLBxhwbTEMosTjD8psiJbgmudW/9QYb5ZRoMN9EGeVDSgbm93EEPr2PZrTTU5kj03nrgNCCmdWC6sVVNyYCz/cXM0L18 "Java (OpenJDK 8) ‚Äì Try It Online")
[Answer]
# MATL, 4 bytes
Saved a byte thanks to [Luis Mendo](https://codegolf.stackexchange.com/users/36398/luis-mendo)!
```
Yf2=
```
**[Try it here.](https://matl.suever.net/?code=Yf2%3D&inputs=2&version=20.4.1)**
Returns `1` (or an array of several `1`s) for truthy and `0` or  (the empty string) for falsy.
# How?
```
Yf2=   % Full program.
Yf     % Prime factors.
  2=   % All equal 2?
       % Output implicitly.
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 5 bytes
```
q]2{P
```
**[Verify all the test cases.](https://pyth.herokuapp.com/?code=q%5D2%7BP&test_suite=1&test_suite_input=1%0A2%0A4%0A16%0A128%0A10%0A12&debug=0)**
Alternative:
```
q2s{P
```
# Explanation
```
q]2{P  ~ Full program with implicit input (Q) at the end.
    P  ~ Prime factors.
   {   ~ Deduplicated.
q      ~ Equals?
 ]2    ~ The literal [2].
       ~ Output (implicitly).
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~37~~ ~~33~~ ~~27~~ 18 bytes
Thanks to @MD XF for the idea
```
f(n){n=(n^n-1)>n;}
```
[Try it online!](https://tio.run/##HcjNCkBAEADg@zzFptRMOFBcBk8ipdVopwzJTZ59/XzHzxeL9zEKGl3WoY1WlNQb31EZ1ikYElzgXrIdqF3J2lZ1w5pl9PcniENBJXL7EewUTNJ5sCRXYrghPg "C (gcc) ‚Äì Try It Online")
[Answer]
# JavaScript, ~~14~~ 11 bytes
-3 thanks to Deadcode
```
f=
n=>!(n&n-2)
// test numbers 0-16
const tests = [f(0), false, true, false, true, false, false, false, true, false, false, false, false, false, false, false, true]
const results = tests.map((res, n) => res === f(n))
document.write(
  results.every(res => res)
    ? "All tests passed üòä"
    : [
        "Tests failed üò¶",
        ...results.map((res, n) => !res && `f(${n}): expected ${tests[n]}`).filter(Boolean),
      ].join("<br />")
)
```
```
body{font-size:3rem;font-family:monospace}
```
Explanation - this uses [this trick](https://stackoverflow.com/a/1053594/1903116) for checking if `n` is a power of 2, but uses `n&n-2` instead of `n&n-1` to make 1 return false
[Answer]
# Regex (Java / Perl / PCRE / .NET), 12 bytes
`^(\1\1|^x)*x$` - **13 bytes** - Powers of 2
`(\1\1|^x)+x$` - **12 bytes** - Completely even
| Regex engine | Powers of 2 | Completely even |
| --- | --- | --- |
| Java | [Try it online!](https://tio.run/##bVJdb9swDHzvr@CMDZHSRHXWt6nGsA0bMGDthvYxTQHFlhOlMu1JcuO062/PKMf7KBC/0CRPR92JG/Wgppvifm@qpnYBNpQLU4uxhP8rbTD2aM3ple6oc9K0S2tyyK3yHi6VQXiCoeaDChQealNARR12E5zBFSi38vMFh7B29dbD5y7XTTA1nTwB@GKshjJDve1/WSLyutCC@gmXH9uy1E4X11oV2sGyh70ssj8nh7TkXA5z/STI7TryM@azJWlQxTeDmnH@KsPWWm5K5oX@2SrrWXI2Ho8Tzp9eQg8MjIWjBE/EEP4yEMEZMSwJdy/9aTa6xVGMQT4fas8/VAjaIbhs@CO1VRMHeC7JjWVdW60QHrOSGLWEm1whknSDTRsgg6h2qLGbnQ@6Ega5hEFnDxNr5a90F@iavcUAgyGW7k4cBxASYpA49OcLsNSOKOEbawJLpvQIhA@AKXW@YqA1cKJRzmtKmJ2nCz4BnB1tCqtxFdYXb@E9RCS8ozBbEGO@Vm6@6AY9fYazhYQPzqmdF6WxlnWTUTfqTQEoaxe10TUyTCXgRYYzCqenJPBShXxNDlXE5kR1yFi/uUgL/onIDxsjtk41bBiR183ue3mtcKVpUjpBzqPSElhF47Eg7@LbPvLB5Joc2zoTNIuPyuVjFlwb3@dfuyEPQ8mSNz4hS7h8jt9J3Kr9Hbud3c5@3XV83L3exzXZp9Pz8zRNfwM "Java (JDK) ‚Äì Try It Online") | [Try it online!](https://tio.run/##bVLbbtswDH3PV3DGhki5qE6fhqnGsA0bMGDdhvYxzQDFlhO1Mu1JcuO067dnlONdCsQvNMmjQ50j3qp7Nb8t7g6mamoX4JZyYWoxkfB/pQ3Gnqw5vdEddUZNu7Ymh9wq7@FSGYRHGGo@qEDhvjYFVNRh18EZ3IByG79ccQhbV@88fOxy3QRT08kRwCdjNZQZ6l3/yxKR14UW1E@4fN@WpXa6uNKq0A7WPex5kf05OaQl53KY62dB7raRnzGfrUmDKr4Y1IzzFxm21nJTMi/0z1ZZz5KzyWSScP74HHpkYCycJHgkhvCXgQjOiGFNuDvpp9n4BscxBvl0rD19VyFoh@Cy4Y/UVk0c4LkkN9Z1bbVCeMhKYtQSrnOFSNINNm2ADKLaocau9z7oShjkEgadPUxslf@qu0DX7C0GGAyxdHfiOIKQEIPEob9cgaV2RAnfWBNYMqdHIHwATKnzGQOtgRONcl5TwuwyXfEZ4OJkU1iNm7C9OIe3EJHwhsJiRYz5Vrnlqhv09BkuVhLeOaf2XpTGWtbNxt24NwWgrF3URtfIMJWAFxkuKEynJPBShXxLDlXE5kR1zFi/uUgL/oHIjxsjdk41bBiR183@W3mlcKNpUjpDzqPSElhF47Eg7@LbPvDB5Joc2zkTNIuPyuVDFlwb3@dfuyEPQ8mSVz4hS7h8it8obtWB3SxuFr9@dHzavTzELTmk89fnafob "Java (JDK) ‚Äì Try It Online") |
| Perl | [Try it online!](https://tio.run/##RY7NasMwEIRfZQlLrG1sLKX0UlmpA@m1p97qRCQhBoGauJILLqr66q7iBnpZdmZ/5utOzj6M71@ATkKwl@PeApYySVVt1q/rVYT24hh6xWW1khTAtElR6Jw59zBrzjMZobbKd9b0LCuy3H8efJ9OdF6IXNDp47r09O/y5NMjapLXXz4l7l1tqyWF2r6JrUqVb@Ut19wkmkpN49QtFhRMC4xlQwYDpCUiUD9QoispoJ/PJ7iJLYEL@ceKRsYYtX5@2Wg97lgjGvG9G@huwHHkhbhfcs5/AQ "Perl 5 ‚Äì Try It Online") | [Try it online!](https://tio.run/##RY5fS8MwFMW/ymVc1lza0mQgiGlmB/PVJ9/sDHOsEMi2mlSoxPjVa1YHvlzuOffP@fVHZ@@m0xegkxDs5bC3gJVMUtXbzctmHaG7OIZecVmvJQUwXVIUemfOAyza80JGaKzyvTUDy8qs8J/vfkgnuihFIej4cV16/Hd58ukBNcnrL58S966x9YpCY1/FTqXKd/KWa24STa3mcerynILpgLFszGCEtEQE6gcqdBUF9MvlDDezJXAh/1jRyBij1k/PW60n1opWfL@NlI84Tby8X3H@Cw "Perl 5 ‚Äì Try It Online") |
| PCRE | [Try it online!](https://tio.run/##XVBda8IwFH33V4QQaKKptuo2JBZftoEw9rDtzWqoXWrDYhrSCAW3397dyp72kMv9OufcHFe7fr1xtUPEowzhGUZT5Lw6Sa@cKUpFo9l0vJGyLkyQZXN22iif05yJ/G3WRhxF8CpoypMaFmxQNrRUyufty5OUjKOUASUQi5G2WrYqUOxKr6bHovwKHoI0@qwD5ggv56vl6v5hvrrDTIyqxlOis0QQk1XA3tL3j8ftKxPsinRFidm1wRtlIWNxus8ynFvMYLm9HGECbZ7wOGUDXnXONJ@K4hhzWBeAL5uLDQN2PQfQDgggJnsxQuimbP9qYtfZbQ7ZZMJAGtGbQ@cilDUlnoPYYJcqAo26iBPLGEPX4UTNVFk3w10CwVdSgYYaESt@QObnn62Uif5A8zRPvw8dG3ek75M4XSySJPkF "PHP ‚Äì Try It Online") | [Try it online!](https://tio.run/##XVDLasMwELznK4QQWGrkxDbpIygml7YQKD20vcWpcFw5FlVkIStgSPPt7jr01IOWfc3MalzjhtXaNQ4Rj3KE5xjNkPPqIL1ypqwUjeazm7WUTWmCrNqj00b5ghZMFG/zLuIogldDUx7UuGCDsqGjUj5vXp6kZBylDCiBWEy01bJTgWJXeTXbl9V38BCk0UcdMEd4kS0Xy7v7bHmLmZjUradE54kgJq@BvaPvH4@bVybYGemaErPtgjfKQsbidJfnuLCYwXJ32sME2jzhccpGvOqdab8UxTHmsC4AX7UnG0bsKgPQFgggJjsxQeiqbP9qYlf5dQ7ZdMpAGtGrQ8cyVA0lnoPYaJcqA436iBPLGEPn8UTNVNW0410CwVdSgcYaESsuIHP5ZytlYqBFWqQ/nz2b9mQYkvghS5Jf "PHP ‚Äì Try It Online") |
| .NET | [Try it online!](https://tio.run/##RY9Ra4MwFIX/SpALJnUpcX1rCBT23F9gLYi7nYH0RmKKUpvf7nRj7PE7HD7O6f2IYejQuQWCqQJ@4VQfj4QjP@XLlV/KS/m6TmI3wZKf3rIPf@@tw89MaHgapW8@YNN2HByzxMBS/4hihsaAk0PvbMxkpu2NQ7Nv/YOidJG9b4XCQFOpOq0CDmQqS7H@STSQdPjH5cZFIebNEfbnJrYdDjyf8h2Q@I2fYh6DjSg7P8S0zir1PzNJfn3jLCEDSiktSh4OSqlv "PowerShell ‚Äì Try It Online") | [Try it online!](https://tio.run/##RY/RaoQwFER/JcgFk9oscZ/KhsBCn/sFroVg79ZA9kZiFmVtvt1qS@njGYbDzBAmjGOP3q8QTRPxE@f2dCKc@Llc@aW@1F/vs6hmWMvzc/EaboPz@FEIDQ@j9DVEtF3PwTNHDBwN9yQWsAa8HAfvUiEL7a4c7KELd0rSJ3bcC5UB26g2bwIOZBpHqf1JNJD0@Mf1zlUllt0RD282dT2OvJzLJyDxGz/EMkWXUPZhTHmbVet/ZpLCdsY7QgaUc16VfDkq9Q0 "PowerShell ‚Äì Try It Online") |
Subtracts increasing powers of 2 from \$tail\$, starting with \$1\$. As such, the sum of the subtracted powers will be \$2^a-1\$ where \$a\$ is the number of iterations so far. Once the loop has matched as many iterations as it can, asserts that the remaining \$tail=1\$.
Unlike the ECMAScript regexes, this needs to do no backtracking, thus is orders of magnitude faster in standard regex engines.
As with the 17 byte ECMAScript regex, it is quite suitable for solving this challenge, as the only change necessary is upping the minimum iteration count of the loop from `0` to `1` by changing the `*` quantifier to a `+`, at a cost of 0 bytes. But an added bonus here is that the first iteration of the loop can only match at the beginning of the string, so we can remove the first `^` anchor to save 1 byte. This does make the regex much slower in most regex engines though.
# Regex (Java / Perl / PCRE / Python[`regex`](https://github.com/mrabarnett/mrab-regex) / Ruby / .NET), 22 bytes
`^((?=(\3\3|^x))(\2))*x$` - **23 bytes** - Powers of 2
`((?=(\3\3|^x))(\2))+x$` - **22 bytes** - Completely even
| Regex engine | Powers of 2 | Completely even |
| --- | --- | --- |
| Python `import regex` | [Try it online!](https://tio.run/##NY5BasMwEEX3PsUguphJbSPFi4Ad0YPYDoRWSVSUsRmp1IHe3Y1cuhvm8R5/fqTbxM3q7/MkCeIjluKubik/48QdiBWl1HpCfLM4NEPzc1qIcNgT7ZaX9cl601Zm7MBbXVwmgQCec6aO6cNzW0CwoY5z8AlVpagAf4HgGAMd9y2E3ow29HosIMucZTnz1aHnhBlQ@XeZkV4NPXs5sE2sozvL@w2lBLWoHW8wU9/CLNmi7WFN9z9o@kr1t/jkMCZBJlp1ZQ5a618 "Python 3 ‚Äì Try It Online") | [Try it online!](https://tio.run/##NY7RSsQwEEXf@xVD8GHGbUuy9ak1@CFthUWzu5E4KZOIXfDf66bi2zCHc7jLLV8jd5v/XKJkSLdUi7u4tf5IkQcQK0qpDfHF4tRN3c/rSoTTkeiwPmx3NJq@MfMA3urqHAUCeC6VNuV3z30FwYY2LcFnVI2iCvwZgmMM9HzsIYxmtmHUcwVF5iLLiS8OPWcsgOq/y8x0MHTvlcC@sE3uJG9XlBrUqh55h4X6HhYpFu0Pa4b/QfErt9/is8OUBZlo082T0foX "Python 3 ‚Äì Try It Online") |
| Ruby | [Try it online!](https://tio.run/##PY5Bi8IwEIXv/oqxCCZCh7QePMQggl49yN5aDYqxBsJY0ohdWPzr3UR2PczAvHnfm/GP8/fgQcHeNKZvkcwTNuuvNXpzukiwSkh43qwz4FRjQjcCsFdwVV4clMpqymRcuEog5uVBgqFLdEQFu9bZwKb5lP8h6Aw14cb4soxMFfmIfZDr3QOBJUgihru2rBAcMRk/Y/S9s1jWZzPioF7gZRLsOP3ZPkL3zkt/F3H2lgLQ/4nUU2m93W20Ho6MrRSr5/X859hzzuqS81k/GQaRFwshxC8 "Ruby ‚Äì Try It Online") | [Try it online!](https://tio.run/##PY5Bi8IwEIXv/oqxCCa7dEjrRciGRdCrB9lb6wbFWANhLGnECuJfr4nsepiBefO@N@Mv@9vgQcHGNKZvkcwVloufBXqzO0iwSki4nqwz4FRjQjcCsEdwVV5slcpqymRcuEog5uVWgqFDdEQFu9bZwKb5lP8h6Aw14cT4VxmZKvIReyPHswcCS5BEDGdtWSE4YjK@x@h7ZbGszz6Ig3qAl0mw4/RnewndKy/9XcTZWwpA/ydST6X1ar3UemDsW7F6Vs/uvz3nrC45/@wnwyDyeSnEEw "Ruby ‚Äì Try It Online") |
This is a direct port of the 13 byte / 12 byte regex. Ruby, and Python's `regex` module, do not support nested backreferences, so they must be emulated via forward-declared backreferences. (Python's `re` module doesn't even support the latter.) The 13 byte version of this is faster than the 17 byte regexes, but golf-wise, they win.
Although this results in a fast regex that's compatible with six different engines, the [recursive solutions](https://codegolf.stackexchange.com/a/259835/17216) provide the best golf for Python's `regex` module and Ruby.
### \$\large\textit{Full programs}\$
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 18 bytes
```
.+
$*
(\1\1|^.)+.$
```
[Try it online!](https://tio.run/##Dcg5CoAwAEXB/p0jQjQQ/FlcTuAlgmhhYWMhlt49OuXcx3Nee23sslXvMB22qOhdfeu8qbVHBCKJzMDIxIz@FAooooQyGj4 "Retina 0.8.2 ‚Äì Try It Online")
Takes its input in decimal. Uses the Java/Perl/PCRE/.NET pure regex.
# [Perl 5](https://www.perl.org/), 24 bytes
```
say 1x<>~~/(\1\1|^.)+.$/
```
[Try it online!](https://tio.run/##RU7NasMwGHuVb8YQm/w0GesOjROyS0YPu@ywS9sNE5zF4NjGDrSjS497gD3iHmRpaBm7CAkJSVY4tZy0gT13Wup3D4E4WOFkL/TA1Wrle@6Gng9NF@RgrNCkjlC5RjSHfSeVIKykx6Yzvc0rVXir5ECCOIjw25yQLfENV9xVit3SY6U22a6YMd2N0BpHsLyqHEtWXNyZhSE9ev4BNWA5jtAo4wWp6f86u6xXD8@PLwVao78jN8K0hFK4viFYFawu56B1Ug@AVYTg5@sbUD7N7XhzYOXptCDbbJt9viY0TPBiGqc0vr/7NXaQRvspflomaZaeAQ "Perl 5 ‚Äì Try It Online")
[Answer]
# Regex (PCRE1), 11 bytes
`^(x(?1)?x|x)$` - **13 bytes** - Powers of 2
`^(x(?1)?x)$` - **11 bytes** - Completely even
| Regex engine | Powers of 2 | Completely even |
| --- | --- | --- |
| PCRE1 | [Try it online!](https://tio.run/##hVPbbtpAEH3nKya0CetgIrtIVWXjRGlK1QeaVIhIrQi1XLOGVc3aWq8LSeDXS2d37cS5SLX8sJczZ86cmY3zvLeI4/0bxuO0nFMY5LGgJ8vTVryMBIT5dAYBjNsf1@vfv/rlj9vb75Pl@/WS7H@SDTlzrbPNdmO93VvPAW0bjvMgzLuu33okL@ScZYq9eSQYXzw9Yxme0mj1EnfaYlxCjksZUiEyQeKMFxK02uMVLYpoQa17zON5MQJgMIDqVC31OeXz1AdBZSk4uP5OU64ixokF9y3AL59itpRykls9dxY4PpSI6b8LJWRqpwIWuNBgzWnU4UVeSh@Uh3AsqA9NdSgnl8JEC1qUqTRrVUeSFFTakJUS0y7k0txkf2gsMzHtz0wqZA00eRhnq5yllOQ2fLsYD8NPV5Pz0Qi2Znc9@fzBhiOT0CzqDI5lqFgC5EBQq/Yh0Z4mBKtBtA1tRaSlCYhQiQ6Hw7kHh8UNx@42OE2eijjBAKLE3ymntDkLKlPGKTFdYdw2Plk@Ytzacy0Kw7iDNUYyY0SDTuIQvSWWZQN3bcizAq/NTcL4nHR6nSqx@rirDELMQdDsi@dxdXj2Ci90Nb4LKMTD5I9cpmkqHadrs5tyt@vOfJyoFRZOChs6m44ShqUUeDkLGvEPRrCAq5kZBNz1odtlzYpNV9Us1J2lGxoTQW24vB6NbMAcDLum/2ocbOg3Sq6bWbGcBuDAdluTog96Iobj8dU4vLz6ej65@PJcQE1xZwE6oyolnRveMf3xX0BNG3FU1Yti/qtUVfoBijk6@o@YJ3xtD4Zq6NpPeXevO9aw2yB2LT2ynhlFQSkqsR4ee/XqWru903Ndx/kbJ2m0KPa9VFn/Dw "C++ (gcc) ‚Äì Try It Online") | [Try it online!](https://tio.run/##hVNtb5swEP6eX3HN1sY0pIJFmiYIrbqu0z5k7RSl0qY0Q4wYYo0YZMySvuSvLzvb0NIXaYgP9r0899xz57goBmkc794wHmfVgsKoiAU9Wh534mUkICxmcwhg0v24Xv/@Nax@3Nx8ny7fr5dk95NsyIlrnWystzvrubtrw2ERhEXf9TuP0KVcsFxht02C8fSpjeVopdHqZdxxh3EJBR5lSIXIBYlzXkrQXA9XtCyjlFp3WMfzYgyA0QhqqzpqO@WLzAdBZSU4uP5WQ64ixokFdx3Ar5hhtYxyUlgDdx44PlQYM3wXSsjVTSWkeNDBGtOwQ0dRSR@UgnAoqA9tdkinkMJkC1pWmTRn1UeSlFTakFcSy6ZyaTz5HxrLXMyGc1MKUQMNHsb5qmAZJYUN384m5@Gny@npeAz35nY1/fzBhgNT0ByaCo5loFgCZE9Qq9Eh0ZomBLvBaBu6CkhTExAhE50O@wsP9strjtNtYZo6NXCCCUSRv1VKaXFSKjPGKTFTYdw2Olk@xriN5poUpnEHe4xkzogOOopD1JZYlg3ctaHIS3QbT8L4gvQGvbqw@rirBMKYvaA9F8/jynjyCi70dXwfkIiHxR@xzNBUOU7X5jbjbt@d@7hRK2yclDb0Nj1FDFsp0TkPWvkPQrCAq50ZBdz1od9n7Y7NVNUuNJOlGxoTQW24uBqPbcAaDKem/3odbBi2Wm6GWaMcB@DA/X0DijrojTifTC4n4cXl19Pp2ZfnBBqIWwtQGdUp6V3znpmP/yLUjBFXVb0o5r8KVZcfIZmDg/@QeYLX9eBcLV33Ke72dcVacpuIbUevrGdWUVCKTKyHx16/us525wxc13H@xkkWpeVukCnp/wE "C++ (gcc) ‚Äì Try It Online") |
I'm not sure when this recursive regex was originally discovered. It was likely an accidental discovery, when someone tried to match palindromes and found that due to PCRE1's atomic subroutine calls, words consisting of only one distinct letter would only match when their length was a power of 2.
Explaining why this works is complicated, but I do intend to do it sometime.
This regex is absolutely phenomenal at being ported to this challenge; it loses 2 bytes in doing so.
# Regex (Perl / PCRE), 15 bytes
`^x(x(?1)?+x|x|)$` - **16 bytes** - Powers of 2
`^x(x(?1)?+x|x)$` - **15 bytes** - Completely even
This is a port of the PCRE1 regex to engines that may have non-atomic subroutine calls.
| Regex engine | Powers of 2 | Completely even |
| --- | --- | --- |
| Perl | [Try it online!](https://tio.run/##RY5fa8IwFMW/ykWCzaUtTYS9LI2t4F598m1zwQ0LgUxrUiEjxq9eYyfs5XLPuX/Orz9Y8zL@/AKxAoI5fe8NkEokKev1artaRuhOlhInmaiXAgPoLikMvdXHAWYfx5mI0BrpeqMHmpVZ4S5fbkgnqih5wfFwfiw1/y5LPr4SheLxy6XEvW1NvcDQmne@k6mynXjm6qckupbTOHV5jkF3QGnmM/CQlhBB3qAitsJA3Hw@wU1sCZyLP1aiRYxRqbfNWqnx01NPG45N7q/@imQcWbngjN0B "Perl 5 ‚Äì Try It Online") | [Try it online!](https://tio.run/##RY5fa8IwFMW/ykWCzaUtTYS9mMZWcK8@7W1zwQ0Lgag16SAji1@9i1Xw5XLPuX/Orz9Y8zIef4FYAcGcv/cGSCWSlPVm/bZeRejOlhInmahXAgPoLikMvdWnAWYfp5mI0BrpeqMHmpVZ4X6@3JBOVFHyguPhcltqni5LPi6JQnH75VLi3ramXmBozTvfyVTZTjxy9UMSXctpnLo8x6A7oDTzGXhIS4ggr1ARW2Egbj6f4Ca2BM7FnZVoEWNU6nW7UWr89NTThmOT@z@PZBxZueCM/QM "Perl 5 ‚Äì Try It Online") |
| PCRE1 | [Try it online!](https://tio.run/##hVNdb9owFH3nV9yytThNqMiQpikhrbqOaQ@snRCVNlEWseAEa8GxHDNoC3997NombfohLcqDP@4959xzrxMh2lmS7N4wnuTLGYWeSCQ9mZ82kvlUQizGE4hg2Py4Wv3@1V3@uL39Ppq/X83J7uearMmZ75y5681647zdOc9jmh4ciygWrh82HvFLNWOFJqgfScazp2eswFM6XbyMO20wrkDgUsVUykKSpOClAiP4eEHLcppR5x55giDBAOj1YH@ql@ac8lkegqRqKTn44dZALqaMEwfuG4CfGCNbTjkRTtufRJ0QlhjTfRcrKPROJ2S4MMEG06rDC7FUIWgb4VjSEOrqUI5Q0mZLWi5zZde6jjQtqfKgWCqkzdTc3hR/aKIKOe5OLBWiRgY8ToqFYDklwoNvF8N@/OlqdD4YwMburkefP3hwZAntomLoOBaKpUAOJHUqH1LjaUqwGoz2oKmBjDQJU1Ri0uFwFsBhecOxuzVMy7MHTjGBaPF32iljTkZVzjgltiuMe9YnJ8QYv/LciMI03sEap6pgxASdJDF6SxzHA@57IIoSr@1NyviMtNqtPbH@uK8NwpiDqN6XIOD68OwVXHBNvAsoJEDyRyzbNE3H6cruxtx3/UmIE7XAwknpQWvd0sKwlBIvJ1Et/8EIFnE9M72I@yG4LqtXbLuqZ6HqLF3ThEjqweX1YOABcjDsmvn34@BBt1Zy1cw9ymkEHdhsKlD0wUxEfzi8GsaXV1/PRxdfnguoIO4cQGd0paR1w1u2P@GLUNtGHFX9olj4KtSevodijo7@I@YJXjOAvh665lPc7euO1ey2EduGGdnAjqKkFJU4D499/@oa212n7fudzt8kzadZuWvn2vp/ "C++ (gcc) ‚Äì Try It Online") | [Try it online!](https://tio.run/##hVNdb9owFH3nV9yytThNqMiQpikhrbqOaQ@snRCVNlEWseAEa8GxHDNoC3997NombfohLcqDP84999xzrxMh2lmS7N4wnuTLGYWeSCQ9mZ82kvlUQizGE4hg2Py4Wv3@1V3@uL39Ppq/X83J7uearMmZ75y5683aebtznkOaHhyLKBauHzYe6Us1Y4Xmrx9JxrOnZ6zAUzpdvMSdNhhXIHCpYiplIUlS8FKB0Xu8oGU5zahzj3mCIEEA9HqwP9VLc075LA9BUrWUHPxwaygXU8aJA/cNwE@MMVtOORFO259EnRCWiOm@ixUUeqcDMlwYsOG06vBCLFUI2kU4ljSEujqUI5S00ZKWy1zZta4jTUuqPCiWCtNmam5vij80UYUcdyc2FbJGhjxOioVgOSXCg28Xw3786Wp0PhjAxu6uR58/eHBkE9pFlaHjWCqWAjmQ1Kl8SI2nKcFqEO1BUxMZaRKmqMSEw@EsgMPyhmN3a5w2z544xQCixd9pp4w5GVU545TYrjDuWZ@cEDF@5bkRhWG8gzVOVcGIAZ0kMXpLHMcD7nsgihKv7U3K@Iy02q19Yv1xXxuEmIOo3pcg4Prw7BVecA3eBRQSYPJHLts0nY7Tld2Nue/6kxAnaoGFk9KD1rqlhWEpJV5Oolr8gxEs4npmehH3Q3BdVq/YdlXPQtVZuqYJkdSDy@vBwAPMwbBr5t@PgwfdWslVM/cspxF0YLOpSNEHMxH94fBqGF9efT0fXXx5LqCiuHMAndGVktYNb9n@hC@gto04qvpFsfBVqn36Hoo5OvqPmCd8zQD6euiaT3m3rztWs9sitg0zsoEdRUkpKnEeHvv@1TW2u07b9zudv0maT7Ny18619f8A "C++ (gcc) ‚Äì Try It Online") |
| PCRE2 | [Try it online!](https://tio.run/##XVBda8IwFH33V4QQaO5stS1uQ2LpyzYQxh62vVkXapfasJqGNEJB/e3uVva0h1zu1znn5tjGXle5bSxhjmSEzimZEevUXjpl27JSPJjP7nIpm7L1suoOVrfKFbwAUbzP@yAkAb4am3KvxgXjlfE9l/Jl/fosJYQkAaREYjHRRsteeU5t5dRsV1Y/3mGQrT5oT0NCF@lysXx4TJf3FMSk7hxnOosFa7Ma2Xv@8fm0fgMBJ6JrztpN712rDGYQJdsso4WhgMv9cYcTbIdxGCUw4tVg2@5bcRrRENcF4qvuaPyIXaUI2iABxngrJoTclM1fzcwqu80xm04BpQm/OXQofdVw5kIUG@1SpefBEITMAAA5jSdqUFXTjXcJgl9JBBlrwoy4oMzln60cxPVr4APPE8inw3k4A7te4yhN4vgX "PHP ‚Äì Try It Online") | [Try it online!](https://tio.run/##XVBdS8MwFH3frwgh0FzXbm2ZyshKX1QYiA/q2zpDV9M12KUhzaAw/e31dvjkQy7365xzc2xjx01uG0uYIxmhS0oWxDp1lE7ZtqwUD5aLm1zKpmy9rLqT1a1yBS9AFK/LPghJgK/GpjyqacF4ZXzPpXzaPj9KCSFJACmRWMy00bJXnlNbObU4lNWXdxhkq0/a05DQVbpere/u0/UtBTGrO8eZzmLB2qxG9p6/vT9sX0DAheias3bXe9cqgxlEyT7LaGEo4HJ/PuAE22EcRglMeDXYtvtUnEY0xHWB@Ko7Gz9hNymCdkiAMd6LGSFXZfNXM7PJrnPM5nNAacKvDp1KXzWcuRDFJrtU6XkwBCEzAEAu04kaVNV0012C4FcSQaaaMCN@UObnn60cxPgx8IHnCeTz4XsANo5xlCZx/As "PHP ‚Äì Try It Online") |
# Regex (PCRE / Ruby), 16 bytes
`^x(x\g<1>?+x|x|)$` - **17 bytes** - Powers of 2
`^x(x\g<1>?+x|x)$` - **16 bytes** - Completely even
This is a port of the PCRE1 recursive regex to Ruby's subroutine call syntax.
| Regex engine | Powers of 2 | Completely even |
| --- | --- | --- |
| PCRE1 | [Try it online!](https://tio.run/##hVNdb9owFH3nV9yytTglVGRI05QQqq7rtAfWTohKmyiLWHCCteBYjjNoC3997NombfohLcqDP@4959xzr2MhOmkc794wHmflnEJfxJKeLAaNeDGTEInJFEIYNT@uVr9/9coft7ffx4v3qwXZ/VyT9U3a9wan7fVmvXHe7pznQU0XjkUYibYXNB4JCjVnuWaoH0nG06dnLMdTOlu@jBs0GFcgcKkiKmUuSZzzQoFRfLykRTFLqXOPPL4fYwD0@7A/1UtzTvk8C0BSVUoOXrA1kMsZ48SB@wbgJybIllFOhNPxpmE3gBJjeu8iBbne6YQUFybYYFp1eCFKFYD2EY4lDaCuDuUIJW22pEWZKbvWdSRJQZULeamQNlULe5P/obHK5aQ3tVSIGhrwKM6XgmWUCBe@nY8uok9X47PhEDZ2dz3@/MGFI0toFxVD17FQLAFyIKlT@ZAYTxOC1WC0C00NZKRJmKESkw6Hcx8OixuO3a1hWp49cIIJRIu/004Zc1KqMsYpsV1h3LU@OQHGeJXnRhSm8S7WOFM5IyboJI7QW@I4LnDPBZEXeG1vEsbnpNVp7Yn1xz1tEMYchPW@@D7Xh6ev4ELbxLcBhfhI/ohlm6bpOF3Z3YR7bW8a4EQtsXBSuNBat7QwLKXAy2lYy38wgoVcz0w/5F4A7TarV2y7qmeh6ixd05hI6sLl9XDoAnIw7Jr59@PgQq9WctXMPcoghC5sNhUo@mAm4mI0uhpFl1dfz8bnX54LqCDuHEBndKWkdcNbtj/Bi1DbRhxV/aJY8CrUnr6PYo6O/iPmCV7Thws9dM2nuNvXHavZbSO2DTOyvh1FSSkqcR4e@/7VNba7bsfzut2/cZLN0mLXybT1/wA "C++ (gcc) ‚Äì Try It Online") | [Try it online!](https://tio.run/##hVNdb9owFH3nV9yytTglVGRI05QQqq7rtAfWTohKmyiLWHCCteBYjjNoC3997NombfohLcqDP@4959xzr2MhOmkc794wHmflnEJfxJKeLAaNeDGTEInJFEIYNT@uVr9/9coft7ffx4v3qwXZ/VyT9U3a9wan7fVm7bzdOc9jmi4cizASbS9oPOIXas5yTVA/koynT89Yjqd0tnwZN2gwrkDgUkVUylySOOeFAiP4eEmLYpZS5x55fD/GAOj3YX@ql@ac8nkWgKSqlBy8YGsglzPGiQP3DcBPTJAto5wIp@NNw24AJcb03kUKcr3TCSkuTLDBtOrwQpQqAG0jHEsaQF0dyhFK2mxJizJTdq3rSJKCKhfyUiFtqhb2Jv9DY5XLSW9qqRA1NOBRnC8FyygRLnw7H11En67GZ8MhbOzuevz5gwtHltAuKoauY6FYAuRAUqfyITGeJgSrwWgXmhrISJMwQyUmHQ7nPhwWNxy7W8O0PHvgBBOIFn@nnTLmpFRljFNiu8K4a31yAozxKs@NKEzjXaxxpnJGTNBJHKG3xHFc4J4LIi/w2t4kjM9Jq9PaE@uPe9ogjDkI633xfa4PT1/BhbaJbwMK8ZH8Ecs2TdNxurK7Cffa3jTAiVpi4aRwobVuaWFYSoGX07CW/2AEC7memX7IvQDabVav2HZVz0LVWbqmMZHUhcvr4dAF5GDYNfPvx8GFXq3kqpl7lEEIXdhsKlD0wUzExWh0NYour76ejc@/PBdQQdw5gM7oSknrhrdsf4IXobaNOKr6RbHgVag9fR/FHB39R8wTvKYPF3romk9xt687VrPbRmwbZmR9O4qSUlTiPDz2/atrbHfdjud1u3/jJJulxa6Taev/AQ "C++ (gcc) ‚Äì Try It Online") |
| PCRE2 | [Try it online!](https://tio.run/##XVBdS8MwFH3frwgh0MSlW1umMrK6FxUG4oP6ts7Q1XQNZmlIMyi4/fZ6O3zyIZf7dc65Oa5xw2rtGoeIRznCc4xmyHl1kF45U1aKRvPZzVrKpjRBVu3RaaN8QQsmird5F3EUwauhKQ9qXLBB2dBRKZ83L09SMo5SBpRALCbaatmpQLGrvJrty@o7eAjS6KMOmCO8yJaL5d19trzFTEzq1lOi80QQk9fA3tH3j8fNKxPsB@maErPtgjfKQsbidJfnuLCYwXJ32sME2jzhccpGvOqdab8UxTHmsC4AX7UnG0bsKgPQFgggJjsxQeiqbP9qYlf5dQ7ZdMpAGtGrQ8cyVA0lnoPYaJcqA436iBPLGEM/44maqappx7sEgq@kAo01IlZcQObyz1bKxPDZ0744rNKH9bQ/92dGhiGJszRJfgE "PHP ‚Äì Try It Online") | [Try it online!](https://tio.run/##XVBdS8MwFH3frwgh0MSlW1umMrK6FxUG4oP6ts7Q1XQNZmlIMyjM/fZ6O3zyIZf7dc65Oa5xw2rtGoeIRznCc4xmyHl1kF45U1aKRvPZzVrKpjRBVu3RaaN8QQsmird5F3EUwauhKQ9qXLBB2dBRKZ83L09SMo5SBpRALCbaatmpQLGrvJrty@o7eAjS6KMOmCO8yJaL5d19trzFTEzq1lOi80QQk9fA3tH3j8fNKxPsjHRNidl2wRtlIWNxustzXFjMYLk77WECbZ7wOGUjXvXOtF@K4hhzWBeAr9qTDSN2lQFoCwQQk52YIHRVtn81sav8OodsOmUgjejVoWMZqoYSz0FstEuVgUZ9xIlljKHzeKJmqmra8S6B4CupQGONiBUXkLn8s5UyMXz2tC8Oq/RhPe1/ekaGIYmzNEl@AQ "PHP ‚Äì Try It Online") |
| **Ruby** | **[Try it online!](https://tio.run/##PY5BawIxEIXv/RXTpWBi2SHZa4wi2GsPxdtqg2JcA2FcshFTEP/6NpHWwwzMm/e9mXDZ/4wBNHzZzqYeyV5htVwvMdjdQYHTQsH15LwFrzsbhxcAdwTf1nKrdbWhSuWFbwVi3WwVWDpkR1Zw6L2LbFJP@B@C3lIXT4zPmsy0mc/YEzmeAxA4giJiPBvHpOCIxfgcs@@RxapUTYmDvkNQRXCv5c/@EodHXvlb5jk4ikD/J0ovZczH58qY8TuxtOlmcr54T7d042/jKGrZCPEL "Ruby ‚Äì Try It Online")** | **[Try it online!](https://tio.run/##PY5BawIxEIXv/opxKZi07JDsNaZFsNceirfVBsW4BsK4ZCOmUPzrayLWwwzMm/e9mXDe/Y4BNHzbzqYeyV5guVgtMNjtXoHTQsHl6LwFrzsbhwmAO4Bva7nRulpTpfLCtwKxbjYKLO2zIys49N5FNqtn/IGgt9TFI@PzJjNt5jP2RA6nAASOoIgYT8YxKThiMT7H7LtnsSpVr8RBXyGoIrhp@bM/x@GeV/6WeQ6OItD/idJLGfP5tTRm/Eksrbu5fP94S3@Jv4yjqGUjxA0 "Ruby ‚Äì Try It Online")** |
# Regex (Perl / PCRE2 / Boost / Python[`regex`](https://github.com/mrabarnett/mrab-regex)), 15 bytes
`^x(x((?1))\2|)$` - Powers of 2
`^x(x((?1)?)\2)$` - Completely even
| Regex engine | Powers of 2 | Completely even |
| --- | --- | --- |
| Perl | [Try it online!](https://tio.run/##RY5fa8IwFMW/ykWCzcWWJoW9LI1WcK8@@TZdcMNCINMu6aAjxq/eXTthL5d7zv1zft3Ju6fx8weYVxDd5ePogJWKpK436916maC9eM6CFqpeKoxgW1IYO2/PPcz255lK0DgdOmd7nhVZHr7fQ08nJi9kLvH0dV9a/buCfHxmBtX9V6DEo29cXWFs3Ks8aKrioB659iGZrfU0pm6xwGhb4DwbMhiAlhBB36BkvsTIwnw@wU1sBC7VHyuzKqVkzMt2Y8z4NvCB85VE3FdXZOMoikoK8Qs "Perl 5 ‚Äì Try It Online") | [Try it online!](https://tio.run/##RY7NasMwEIRfZQlLrCU2lgy9RFbsQHrtqbcmFWmJQaAkjuSCi1Bf3VXcQC/LzuzPfP3J2afp/A3oJAR7/TxawFImqerd9nW7idBdHUOvuKw3kgKYLikKvTOXARb7y0JGaK3yvTUDy4os918ffkgnOi9ELuh0uy81/y5PPq1Rk7z/8inx6FpbVxRa@yYOKlV@kI9c85BoajWPU7daUTAdMJaNGYyQlohA/UCJrqSAfrmc4Wa2BC7kHysaGWPU@vllp/X0PrKRsUZQQ/uKcJp4UQnOfwE "Perl 5 ‚Äì Try It Online") |
| PCRE2 | [Try it online!](https://tio.run/##XVBdS8MwFH3frwgh0FyXbm2ZysjKXlQYiA/q2zpDV9M12KUhzWAw/e31dvjkQy7365xzc1zjhtXaNY4wT3JC55TMiPP6oLx2bVlpHs1nN2ulmrINquqOzrTaF7wAWbzO@0iQCF@NTXXQ44IN2oaeK/W0eX5UCgRJASmRWE6MNarXgVNXeT3bl9VX8BhUa44mUEHoIlsulnf32fKWgpzUnefM5IlkbV4je8/f3h82LyDhQkzNWbvtg2@1xQzidJfntLAUcLk/7XGCbZGIOIURr8@u7T41pzEVuC4RX3UnG0bsKkPQFgkwJjs5IeSqbP9qZlf5dY7ZdAooTfjVoWMZqoYzL1BstEuXgUfnSDALAOQynmhAV0033iUJfiWVZKwJs/IHZX7@2cpBDh9nfuZ8nQIU2TewYUjiLE2SXw "PHP ‚Äì Try It Online") | [Try it online!](https://tio.run/##XVDNa4MwFL/3rwhBMG@NrUq3UVLxsg0KY4dtt9oF62KVpTHEFITSv909y0475PG@fh95trHjJreNJYEjGaFLShbEOnWUTlldVoqFy8VdLmVTai@r7mRbrVzBChDF@7IPOQnx1diURzUtGK@M75mUL9vXZymBkwSQEonFrDWt7JVn1FZOLQ5l9eMdBqnbU@spJ3SVrlfrh8d0fU9BzOrOsaDNYhHorEb2nn18Pm3fQMCFtDUL9K73TiuDGUTJPstoYSjgcn8@4ATbPOZRAhNeDVZ334rRiHJcF4ivurPxE3aTImiHBBjjvZgRclM2f3VgNtltjtl8DihN2O1Cp9JXDQscR7HpXKr0LBxCHhgAIJfJYguqarrJlyD4lUSQqSaBEVeUuf47KwMxfg1sYCxPIIcCfY1jHKVJHP8C "PHP ‚Äì Try It Online") |
| **Boost** | **[Try it online!](https://tio.run/##dVNtb5swEP6eX3HLpsYu0EIq7QOEVpq0PzDtw6Y0RdRxwFpiLGOUl61/vdnZNIxmxB/A9/bcPXdnplRQMHb8KCRbN0sOs@eqqs2t5gXf3ZRK3Y/OTXzHuDKikrdLkRcSVYJlQq4qvcmtuo1iZa4hU/MFpPBt/GW7/fV81/zc7398Lz9vS3J82pEdIQ8RpY/TP/TTkZ67jH24VmmmvCjplSAwneb55n4kpIFNLiSh8HsEeNQcTWsuiaJBtEjDBBr0uZtmBior2YDCXmqzjGP0FbJApWpM4uJZJWsDjmMcO/6gOYIlJ12N/FgJ2zJ/i0DKQCzsIQ19OPAOvOBmLSQnTmBC@m0empxqtccGyhDbk5tKEOdwwzKsi1Dqg4x8UFWN5tayEnJJJsGEJh2AjNBqfT6kfU5xLK3yYQAXPOfvQUQhxuT/sNy4rm06ybetNJeRFy0S2PBNzQ2pfZjsJrYw7EiNRtviLr5rhUil7fUslVECnif6jO0xen@mcb1YAel3Pqt5rllJSI8XvbJZA7Hw3Qh8nA6lA1gnvAMFpG6pkMmjxMbhmKJk0L2dU9UYmM1A/O/zMrosMbcU5N32dE8ErrjW9ALh4QLPirGfcQxfta70OBnG4RRWFsnB@BbAZk3sRnZ4qOnjje3/rdrhZ0wcxgXi7a39am4aLQGX4eUYBtE0DF/Zap0X9TFYuwyZG@lf "C++ (gcc) ‚Äì Try It Online")** | **[Try it online!](https://tio.run/##dVNtb5swEP6eX3HLpsYu0EIq7QOEVpq0PzDtw6Y0RdRxwFpiLGOUl61/vdnZNIxmxB/A9/bcPXdnplRQMHb8KCRbN0sOs@eqqs2t5gXf3ZRK3Y/OTXzHuDKikrdLkRcSVYJlQq4qvcmtuo1iZa4hU/MFpPBt/GW7/fV81/zc7398Lz9vS3J82pEdIQ8R/UMfp/TTkZ67jH24VmmmvCjplSAwneb55n4kpIFNLiSh8HsEeNQcTWsuiaJBtEjDBBr0uZtmBior2YDCXmqzjGP0FbJApWpM4uJZJWsDjmMcO/6gOYIlJ12N/FgJ2zJ/i0DKQCzsIQ19OPAOvOBmLSQnTmBC@m0empxqtccGyhDbk5tKEOdwwzKsi1Dqg4x8UFWN5tayEnJJJsGEJh2AjNBqfT6kfU5xLK3yYQAXPOfvQUQhxuT/sNy4rm06ybetNJeRFy0S2PBNzQ2pfZjsJrYw7EiNRtviLr5rhUil7fUslVECnif6jO0xen@mcb1YAel3Pqt5rllJSI8XvbJZA7Hw3Qh8nA6lA1gnvAMFpG6pkMmjxMbhmKJk0L2dU9UYmM1A/O/zMrosMbcU5N32dE8ErrjW9ALh4QLPirGfcQxfta70OBnG4RRWFsnB@BbAZk3sRnZ4qOnjje3/rdrhZ0wcxgXi7a39am4aLQGX4eUYBtE0DF/Zap0X9TFYuwyZG@lf "C++ (gcc) ‚Äì Try It Online")** |
| **Python `import regex`** | **[Try it online!](https://tio.run/##NY7BasMwEETv/opF5LDb2kZyb3ZFPsR1ICRKoqKuzEqlDvTfncilt2Eeb5j5nm@R31b/NUfJkO6pFnd1S/2ZIg8gVpRS62HBBXFviD66X9qtz240fWOmAbzV1SUKBPBc9Dbls@e@gmBDm@bgM6pGUQX@AsExBnrvegijmWwY9VRBkbnIcuSrQ88ZC6D6L5mJXg0998rAdq1N7iinG0oNalEvvMFCfQ@zFIu2wprh/1D8zu2P@OwwZUEmWnVjOq0f "Python 3 ‚Äì Try It Online")** | **[Try it online!](https://tio.run/##NY7BasMwEETv/opF5LDb2kZyb3ZFPsR1ICRKoqKuzEqhztc7kUtvwzzeMPMj3yJ/rP5njpIhPVIt7uqW@jtFHkCsKKXWw4IL4t7Qnr462q2vbjR9Y6YBvNXVJQoE8Fz0NuWz576CYEOb5uAzqkZRBf4CwTEG@ux6CKOZbBj1VEGRuchy5KtDzxkLoPovmYneDb32ysB2rU3uKKcbSg1qUW@8wUJ9D7MUi7bCmuH/ULzn9ld8dpiyIBOtujGd1k8 "Python 3 ‚Äì Try It Online")** |
I discovered this recursive regex on 2022-07-18 while working on
[Sum of Powers of 2](https://codegolf.stackexchange.com/questions/179174/sum-of-powers-of-2/250059#250059). It relies on subroutine calls being atomic.
```
^            # tail = N = input number
x            # tail -= 1
(            # Define subroutine (?1)
    x        # match += 1; tail -= 1
    ((?1))   # \2 = match made by recursive call; match += \2; tail -= \2
    \2       # match += \2; tail -= \2
|    # or
             # Match nothing, causing a cascading pop to the top level of
             # recursion, ending the match.
)
$            # Assert that we've reached the end of the string.
```
This is similar to `^(\1\1|^x)*x$`, in that the `(?1)` subroutine call will always return \$2^a-1\$ where \$a\$ is the depth of recursion it reached. This is why an extra \$1\$ is subtracted at the beginning (it could just as easily be done at the end, but that would be slightly slower due to backtracking).
It is very easily ported to solving this challenge; the first iteration at which it has a choice of whether to match nothing just has to be pushed down one level, at a cost of 0 bytes.
# Regex (PCRE2 / Ruby), 16 bytes
`^x(x(\g<1>)\2|)$` - Powers of 2
`^x(x(\g<1>?)\2)$` - Completely even
| Regex engine | Powers of 2 | Completely even |
| --- | --- | --- |
| PCRE2 | [Try it online!](https://tio.run/##XVBdS8MwFH3frwgh0FyXbm2ZykjrXlQYiA/q2zpDV9O12KUhzWAw99vr7fDJh1zu1znn5tjaDunK1pYwRzJC55TMiHV6r5y2bVFqHsxnNyul6qL1quwOtmm1y3kOMn@b94EgAb4Km2qvxwXjtfE9V@p5/fKkFAgSA1IisZw0plG99pza0unZrii/vcOg2ubQeCoIXSTLxfLuPlneUpCTqnOcNVkkWZtVyN7z94/H9StIOJOm4qzd9N612mAGYbzNMpobCrjcH3c4wbaIRBjDiNcn23ZfmtOQClyXiC@7o/EjNk0QtEECjNFWTgi5Kpu/mpk0u84xm04BpQm/OnQofFlz5gSKjXbpwvPgFAhmAICcxxMb0GXdjXdJgl@JJRlrwoy8oMzln60c5PB54iee79P4AfLkB9gwRGESR9Ev "PHP ‚Äì Try It Online") | [Try it online!](https://tio.run/##XVDNS8MwFL/vrwgh0MSlW1umMtK6iwoD8aDe1hm6mq7BLA1pBoXh315fhycPebyv30eea92Yb1zrEPGoQHiJ0QI5r47SK2eqWtFoubjZSNlWJsi6OzltlC9pyUT5tuwjjiJ4DTTlUU0LNigbeirl8/blSUrGUcqAEojFTFstexUodrVXi0NVfwcPQRp90gFzhFfZerW@u8/Wt5iJWdN5SnSRCGKKBth7@v7xuH1lgl2Qbigxuz54oyxkLE73RYFLixks9@cDTKDNEx6nbMKrwZnuS1EcYw7rAvB1d7ZhwuYZgHZAADHZixlCV2X7VxObF9c5ZPM5A2lErxc6VaFuKfEcxKZzqSrQaIg4sYwxdJksaqbqtpt8CQRfSQWaakSs@AGZn39npUyMnwMdaHnM04cNK8HYOCZxlibJLw "PHP ‚Äì Try It Online") |
| **Ruby** | **[Try it online!](https://tio.run/##PY5Bi8IwEIXv@ytmi2Cy0CHpNWZB0KsH2VvrBqWxBsJY0ogVZP96TcT1MAPz5n1vJlwOtymAhq3t7Ngj2Suslj9LDHbfKnBaKLienLfgdWfj8AHgjuDrUu60LhoqVFr4WiCW1U6BpTY5koJD711k83LOXwh6S108Mb6oElMnPmFv5HgOQOAIsojxbByTgiNm43tMvmcWK8biizjoPwgqC@4z/9lf4vDMy3/LNAdHEej/RO65jFlvVsZMvyMbWdMt5DdvqjufTZMoZSXEAw "Ruby ‚Äì Try It Online")** | **[Try it online!](https://tio.run/##PY5Bi8IwEIXv/oqxCCZCh6TXmBVBrx5kb60bdjHWQBhLGrFe/OvdRNTDDMyb972ZcP27jwE07G1rhw7J3mCz/l5jsL9HBU4LBbez8xa8bm3sJwDuBL4u5UHroqFCpYWvBWJZHRRYOiZHUrDvvItsXs75C0FvqY1nxpdVYurEJ@yDnC4BCBxBFjFejGNScMRs/IzJ98xixVAsiIN@QFBZcNP8Z3eN/TMv/y3THBxFoPeJ3HMZs91tjBl/Bjawpl3KrxVvKj4bR1HKSoh/ "Ruby ‚Äì Try It Online")** |
This is a port of the non-atomic recursive regex to Ruby's subroutine call syntax.
[Answer]
# [Thunno](https://github.com/Thunno/Thunno) `-`, \$ 4 \log\_{256}(96) \approx \$ 3.29 bytes
```
bdiP
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72sJKM0Ly9_abSSrlLsgqWlJWm6FkuSUjIDIEyoyIJFxkYQFgA)
or [verify all test cases](https://ato.pxeger.com/run?1=m72sJKM0Ly9_weJ0Q92lpSVpuhZLklIyAyDMBVBqsaGBAYQJAA)
Port of [Dennis's MATL answer.](https://codegolf.stackexchange.com/a/142577/114446)
## [Thunno](https://github.com/Thunno/Thunno) `DD`, \$ 5 \log\_{256}(96) \approx \$ 4.12 bytes
```
1-A^<
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72sJKM0Ly9_WbSSi4tS7IKlpSVpuhZLDXUd42wgbKjQgkXGRhAWAA)
or [verify all test cases](https://ato.pxeger.com/run?1=m72sJKM0Ly9_UXTs4nQXl6WlJWm6FksNdR3jbCDsBVBqsaGBAYQJAA)
Port of [Dennis's Jelly answer.](https://codegolf.stackexchange.com/a/142578/114446)
**Note**: a plain "power of two" answer would be 5 chars: [`b1c1=`](https://ato.pxeger.com/run?1=m72sJKM0Ly9_wYKlpSVpuhZLkwyTDW0hbKgQTAoA) (is the count of 1s in the binary representation equal to 1?)
#### Explanation
```
bdiP  # Implicit input
      # - flag decrements
b     # Convert to a binary string
 di   # Get the list of digits
      # This is a non-empty list of ones
      # if the input is a power of two
   P  # Push the product of this list
      # Implicit output
```
```
1-A^<  # Implicit input
1-     # Subtract one
  A^   # Xor with input
       # The highest set bit will only be conserved
       # if the input is a power of two
    <  # Is more than input?
       # Implicit output
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `g`, 4 bytes
```
K·∏£v‚ÇÇ
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBZyIsIiIsIkvhuKN24oKCIiwiIiwiMlxuNFxuMTZcbjEyOFxuMTBcbjEyXG4xNFxuMThcbjEiXQ==)
Can probably be golfed but it‚Äôs painful to do this on mobile.
Outputs `1` for truthy, `0` or the empty list for falsy.
```
K    # divisors of input
 ·∏£   # without the first element
  v  # vectorize the following over it
   ‚ÇÇ # is even?
     # (after which the `g` flag takes the minimum of the stack)
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 40 bytes
```
param($i)(($i-band(-$i))-eq$i)-and$i-ne0
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/vyCxKDFXQyVTUwNI6CYl5qVo6AJ5mrqphUBKF8gHCuelGvz//9/QyAIA "PowerShell ‚Äì Try It Online")
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2) `M`, 2 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md)
```
‚Åª·∏É
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m728JKM0Ly_faGm0kq9S7IKlpSVpuhbLHjXufrijeUlxUnIxVGjBImMjCAsA)
Port of [Dennis's MATL answer](/a/142577/114446): decrement, convert to binary, take minimum.
---
A plain "power of two" answer would be **4 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md):**
```
2BS·∏Ö
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m728JKM0Ly_faMGCpaUlaboWy4ycgh_uaF1SnJRcDBVasMjYCMICAA)
Convert to a binary list, sum equals one?
[Answer]
# [Neim](https://github.com/okx-code/Neim), 3 bytes
```
ùêÖ·õÉùê©
```
Doesn't work on TIO.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
√ÜEL‚Äô¬¨
```
[Try it online!](https://tio.run/##y0rNyan8//9wm6vPo4aZh9b8///fBAA "Jelly ‚Äì Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina), 25 bytes
```
.+
$*
+`^(11+)\1$
$1
^11$
```
[Try it online!](https://tio.run/##K0otycxL/P9fT5tLRYtLOyFOw9BQWzPGUIVLxZArztBQ5f9/QzMA "Retina ‚Äì Try It Online")
[Answer]
# [Actually](https://github.com/Mego/Seriously), 5 bytes
```
;R‚ôÇ‚ïôc
```
[Try it online!](https://tio.run/##S0wuKU3Myan8/9866NHMpkdTZyb//28BAA "Actually ‚Äì Try It Online")
Explanation:
```
;R‚ôÇ‚ïôc
;      duplicate n
 R     range(1, n+1)
  ‚ôÇ‚ïô   powers of 2
    c  contains n
```
[Answer]
# [Haskell](https://www.haskell.org/), 24 bytes
```
f n=elem n$map(2^)[1..n]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P00hzzY1JzVXIU8lN7FAwyhOM9pQTy8v9n9uYmaegq1CSj4XJ1DCV0EjpkJB106hoLQkuKTIJ09BRaE4I79coUJbW0nXTklbG8TTSFOo0NRUiDbQ0zM0MIj9DwA "Haskell ‚Äì Try It Online")
[Answer]
# [Actually](https://github.com/Mego/Seriously), 4 bytes
```
yN2=
```
[Try it online!](https://tio.run/##S0wuKU3Myan8/7/Sz8j2/39DAA "Actually ‚Äì Try It Online")
]


[Question]
      [
Write a program or function that takes in a non-negative integer N from stdin or as a function argument. It must print or return a string of a hollow ASCII-art square whose sides are each made with N copies of the number N.
### Specifically:
If N is `0`, no copies of N are used, so there should be no output (or only a single trailing newline).
If N is `1`, the output is:
```
1
```
If N is `2`:
```
22
22
```
If N is `3`:
```
333
3 3
333
```
If N is `4`:
```
4444
4  4
4  4
4444
```
If N is `5`:
```
55555
5   5
5   5
5   5
55555
```
The pattern continues for `6` through `9`.
If N is `10`, the output is:
```
10101010101010101010
10                10
10                10
10                10
10                10
10                10
10                10
10                10
10                10
10101010101010101010
```
**Notice that this is not actually square.** It is 10 rows tall but 20 columns wide because `10` is two characters long. This is intended. The point is that each side of the "square" contains N copies of N. **So all inputs beyond `9` will technically be ASCII rectangles.**
For example, if N is `23`, the output is:
```
2323232323232323232323232323232323232323232323
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
23                                          23
2323232323232323232323232323232323232323232323
```
Here are Pastebins of the required outputs for [`99`](http://pastebin.com/raw/Qcas2Qmu), [`100`](http://pastebin.com/raw/1wc2FNmL), [`111`](http://pastebin.com/raw/DGZcHSiS), and [`123`](http://pastebin.com/raw/ajYdGhmw) (they may look wrong in a browser but in a text editor they'll look correct). The output for `1000` is to large for Pastebin but it would have 1000 rows and 4000 columns. **Numbers with 4 or more digits must work just like smaller numbers.**
### Details:
* N must be written in the usual decimal number representation, with no `+` sign or other non-digits.
* The hollow area must only be filled with spaces.
* No lines should have leading or trailing spaces.
* A single newline after the squares' last line is optionally allowed.
* Languages written after this challenge was made are welcome, they just [aren't eligible to win](http://meta.codegolf.stackexchange.com/a/4870/26997).
* **The shortest code in bytes wins!**

[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 20 bytes
```
ẋṅ,⇩(L⁰‹*$S↲₴,)ċ[ẋṅ,
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLhuovhuYUs4oepKEzigbDigLkqJFPihrLigrQsKcSLW+G6i+G5hSwiLCIiLCIxMCJd)
## How?
```
ẋṅ,⇩(L⁰‹*$S↲₴,)ċ[ẋṅ,
ẋ                    # Repeat the (implicit) input the (implicit) input number of times (returns a list)
 ṅ                   # Join by nothing
  ,                  # Print with trailing newline
   ⇩(                # Loop (implicit) input minus 2 times:
     L               #  Get the length of the (implicit) input
      ⁰‹             #  Push the input minus 1
        *            #  Multiply the length by that
         $           #  Swap to make (implicit) input at top
          S          #  Convert the input to a string
           ↲         #  Pad the stringified input with leading spaces until its length is len(input) * (input - 1) calculated earlier
            ₴        #  Print this without a trailing newline
             ,       #  Print the (implicit) input with trailing newline
              )      # Close loop
               ċ[    # If the (implicit) input is not one:
                 ẋ   #  Repeat the (implicit) input the (implicit) input amount of times
                  ṅ  #  Join by nothing to make it a string
                   , #  Print with trailing newline
```
[Answer]
## Pyth, 27 bytes
```
jsMmm?sqM*,dk,0tQ`Q*\ l`QQQ
```
[Test suite](https://pyth.herokuapp.com/?code=jsMmm%3FsqM%2a%2Cdk%2C0tQ%60Q%2a%5C+l%60QQQ&input=12&test_suite=1&test_suite_input=0%0A1%0A10&debug=1).
[Answer]
# Python 2, 70 characters
```
def p(i):
 k=`i`;j=i-2;h=k*i;print h+'\n'+(k+' '*j*len(k)+k+'\n')*j+h
```
[Answer]
# PHP 112 ~~114~~ ~~120~~ bytes
```
<?php $z=$j=$argv[1];while($j){$i=(--$j&&$i)?$z.str_pad('',strlen($z)*($z-2)).$z:str_repeat($z,$z);echo"$i\n";}
```
Command line usage: `php scriptname.php [n]`
[ideone demo](https://ideone.com/lbsfjv)
This golf uses `str_repeat` for the first and last row and `str_pad` for the rows in between.
[Answer]
## Ruby, 79 bytes
```
->n{s=n.to_s
puts s*n
$><<(s+" "*s.size*(a=n-2)+s+$/)*a if n>2
$><<s*n if n>1}
```
Some cases print a trailing line after the last line and some do not, but the question does not disallow this.
[Answer]
# Dyalog APL, 41 bytes
```
{1≥⍵:⍵⍴⍵⋄(' '≠⍕⍵/⍵)/⍕⍵⍪⍨⍵⍪⍵,⍵,⍨''⍴⍨2/⍵-2}
```
[Answer]
# Python 2, 73 characters
```
def l(i):s=`i`;n='\n';l=i-2;b=s*i+n;print b+(s+' '*l*len(s)+s+n)*l+b*(i>1)
```
[Answer]
# Python 3.5, 101 135 bytes:
(*+34 since apparently an input of 1 should just output 1 and an input of 0 should output nothing*)
```
def y(g):g=str(g);i=len(g);[print(g*(int(g))+('\n'+g+' '*((int(g)*i)-(i*2))+g)*(int(g)-2)+'\n'+g*int(g))if int(g)>1 else print(g*int(g))]
```
Prints out all the correct values for any integer input, whether in string form or not.
**Sample Inputs and Outputs:**
```
Input: y(10)
Output:
    10101010101010101010
    10                10
    10                10
    10                10
    10                10
    10                10
    10                10
    10                10
    10                10
    10101010101010101010
Input: y(1)
Output:
    1
Input: y(2)
Output:
    22
    22
Input: y(4)
Output:
    4444
    4  4
    4  4
    4444
```
However, for triple digit numbers, it was just too big to fit on my monitor, so I hope that comes out correct if someone else tries it. I suspect it should since all 1 and 2 digit numbers come out correctly.
[Answer]
## Python 3, 75 characters
```
def q(n):s=str(n);m=n-2;print(s*n,*[s+" "*len(s)*m+s]*m,s*n*(n>1),sep="\n")
```
[Answer]
# PHP, 86 Bytes
```
for(;$i<$a=$argn;)echo str_pad($a>1?$a:"",($a-1)*strlen($a),$i++&&$i<$a?" ":$a)."$a
";
```
[Try it online!](https://tio.run/nexus/php#HYtLCoAgFEXnriIeD8m0oKCJVi4lHv0hVKz9mzQ791zOYMMZGFI83Nj1Ju0@lgavAWn8pRHbcvrieeMcaC2RptYiaQCVuW5FlZ97c3kIhZeUnP@xhQJ0dg0gMTApfQ "PHP – TIO Nexus")
[Answer]
# JS to ES6 compatibilized, ~~136~~ 76 B
```
function x(a){var c='';function Q(){for(var b=0;b<a;++b)c+=a}Q();c+='\n';
for(b=2;b<a;++b){c+=a;for(let A=2;A<a;++a)c+=' ';c+=a+'\n'}Q()}
```
Works way smaller:
```
x=(a,c)=>{Q=(í,k)=>{for(;í<a;++í)c+=k}Q(0,a);c+='\n';Q(2,a+Q(2,' ')+a+'\n')}
```
[Answer]
# [Python 3](https://docs.python.org/3/), 78 bytes
```
N=input()
n=int(N)
m=n-2
b=N*n+"\n"
print(b+(N+" "*len(N)*m+N+"\n")*m+b*(n>1))
```
[Try it online!](https://tio.run/##K6gsycjPM/7/3882M6@gtERDkysPyCrR8NPkyrXN0zXiSrL108rTVorJU@IqKALJJGlr@GkrKShp5aTmAZVp5Wr7gaVBrCQtjTw7Q03N//9NAQ "Python 3 – Try It Online")
I went back and forth over multiple approaches to this (even using `exec()` at one point, then ditching it because it was unnecessary), but I figured out that this is the shortest Python 3 approach.
[Answer]
**Python 2,96 bytes**
```
s=raw_input()
n=int(s)
for i in range(n):
 if 0<i<n-1:print s+' '*(n-2)*len(s)+s
 else:print s*n
```
**Python 3,94 bytes**
```
s=input()
n=int(s)
for i in range(n):
 if 0<i<n-1:print(s+' '*(n-2)*len(s)+s)
 else:print(s*n)
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 16 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
×,<GgIÍ*ú«,}≠i×,
```
[Try it online](https://tio.run/##yy9OTMpM/f//8HQdG/d0z8O9Wod3HVqtU/uoc0EmUOz/f0MDAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V@m5JlXUFpipaBkX6nDpeRfWgLh6VQ@amrRc/l/eLqOjXt65eFercO7Dq3WqX3UuSATKPa/9tA2e82Y/9EGOoY6RjrGOiY6pjqWOoYGOkbGsQA).
**Explanation:**
```
×          # Repeat the (implicit) input the (implicit) input amount of times as string
 ,         # Pop and print this string with trailing newline
<G         # Loop the (implicit) input-2 amount of times:
  g        #  Get the length of the (implicit) input
   IÍ      #  Push the input-2
     *     #  Multiply it by the length
      ú    #  Pad the (implicit) input with that many leading spaces
       «   #  Append it to the (implicit) input
        ,  #  Pop and print it with trailing newline
 }         # Close the loop
  ≠i       # If the (implicit) input is NOT 1:
    ×      #  Repeat the (implicit) input the (implicit) input amount of times as string
     ,     #  Pop and print this string with trailing newline
```
I don't think I've ever used the fact that input can be implicitly as many times in a single program as this one. xD
[Answer]
# [Regenerate](https://github.com/dloscutoff/Esolangs/tree/master/Regenerate), 42 bytes
```
(($~1){$~1})((
$2 {#2}{$2-2}$2){$2-2}
$1!)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72qKDU9NS-1KLEkdcGCpaUlaboWN7U0NFTqDDWrgUStpoYGl4qRQrWyUW21ipGuUa2KkSaEwaViqKgJ0QHVuCxaychYKRbKAwA)
For clarity, space is replaced with `_` and newline is replaced with `¶`:
```
(                    # Capture the first line as $1, for reuse as the last line.
    ($~1){$~1}       # Repeat N in decimal, N times. Capture N in $2 for golf,
                     # which allows referring to it as "$2" instead of "$~1" and
                     # its length as "#2" instead of "#~1".
)
(
    (
        ¶
        $2           # Output N in decimal for the left edge.
        _{#2}{$2-2}  # Output length(N)*(N-2) spaces
        $2           # Output N in decimal for the right edge.
    ){$2-2}          # Repeat the above N-2 times. This will cause a non-match
                     # if N == 1, preventing this entire block from matching,
                     # which will also prevent the top line from being repeated
                     # as the bottom line below.
    ¶
    $1               # Repeat the top line as the bottom line.
!
                     # If N == 1, the above alternative won't be able to match;
                     # do nothing here, to prevent it from triggering a top-level
                     # non-match.
)
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~34~~ ~~30~~ 29 bytes
Code:
```
F¹}JDU,¹!#¹DÍF¹gFð}}¹J¹ÍF=}X,
```
[Try it online!](http://05ab1e.tryitonline.net/#code=RsK5fUpEVSzCuSEjwrlEw41GwrlnRsOwfX3CuUrCucONRj19WCw&input=MTA)
I didn't have some kind of fancy string multiplication function, but here is the submission *with* the function. It's something I added after the challenge and is therefore non-competing:
**26 bytes:**
Code:
```
D×DU,¹¹Í¹g*ð×¹J¹ÍF=}¹1›iX,
```
Uses **CP-1252** encoding.
[Answer]
# Mathematica,116 bytes
```
Switch[#,0,"",1,1,_,#5<>#4[#<>#4[" ",StringLength@#*#3]<>#<>"\n",#3]<>#5&[##,#~#4~#2<>"\n"]&[ToString@#,#,#-2,Table]]&
```
Somewhat long, but oh well.
[Answer]
# Oracle SQL 11.2, ~~106~~ ~~105~~ 115 bytes
```
SELECT RPAD(:1,(:1-1)*LENGTH(:1),DECODE(LEVEL,1,:1||'',:1,:1||'',' '))||:1 FROM DUAL WHERE:1>0 CONNECT BY:1>=LEVEL;
```
10 bytes added to manage 0
[Answer]
# SmileBASIC, 89 bytes
```
INPUT N$N=VAL(N$)Q=N>1FOR I=1TO N?N$*!!N*G;" "*LEN(N$*(N-Q*2))*G;N$*(Q*G+N*!G)G=I<N-1NEXT
```
[Answer]
# Common Lisp, SBCL, 151 bytes
```
(defun c(x)(if(< x 10)1(1+(c(/ x 10)))))(lambda(a)(format t"~:[~v{~a~:*~}~&~v@{~v<~a~;~a~>~4@*~&~}~*~v@{~a~:*~}~;1~]"(= a 1)a`(,a)(- a 2)(*(c a)a)a a))
```
function for counting digits adjusted to CL from Joshua's answer [here](https://stackoverflow.com/questions/19530112/how-to-count-number-of-digits)
### Ungolfed
```
(defun c(x)
    (if(< x 10) 1
    (1+ (c(/ x 10))))) ;counting digits
(lambda(a)
    (format t"~:[~v{~a~:*~}~&~v@{~v<~a~;~a~>~4@*~&~}~*~v@{~a~:*~}~;1~]"(= a 1)a`(,a)(- a 2)(*(c a)a)a a))
;~[~] checks whether agument is equal 1 (if it is equal 1 then print out only "1") - without it we would print out 1\Newline 1
;first loop: ~v{~a~:*~} - printing first line of N
;second loop: uses justification "~<~>" to output enough spaces between N's on sides
;third loop: -printing last line of N
```
[Answer]
## [QBIC](https://drive.google.com/drive/folders/0B0R1Jgqp8Gg4cVJCZkRkdEthZDQ), ~~61~~ 58 bytes
```
;_LA|x=!A!~x=1|?A\Y=A+space$((x-2)*a)+A[x|Z=Z+A]?Z[x-2|?Y]
```
Explanation
```
;          Read A$ from the cmd line
_LA|       Take the length of A$ and assign to a
x=!A!      Cast A$ to int, assign to x
~x=1|?A    If x == 1, quit printing just the 1
\Y=A       Else, setup Y$ as the middle of the square; it starts as the literal input
  +space$( Followed by X spaces
  (x-2)*a) where X is the length of the string x the value, minus start and end
  +A       Followed by the input again
[x|        This FOR loop creates the top row
Z=Z+A]     By concatenating the input x times to itself and assigning it to Z$
?Z         Print the top row
[x-2|?Y]   Print the right amount of middle rows
           And the bottom row (Z$) is implicitly printed at EOF.
```
[Answer]
# Lua, 101 bytes
```
p,n=print,io.read()d,s=#n,n:rep(n)p(s)for i=3,n do p(n..(" "):rep(d*(n-2))..n)end p(n+0>1 and s or"")
```
Alternate 102 bytes:
```
l,n="\n",io.read()d,s=#n,n:rep(n)print(s..l..(n..(" "):rep(d*(n-2))..n..l):rep(n-2)..(n+0>1 and s or""))
```
101 Readable:
```
p,n=print,io.read()
d,s=#n,n:rep(n)
p(s)
for i=3,n do
  p(n..(" "):rep(d*(n-2))..n)
end
p(n+0>1 and s or"")
```
Lua naturally has a small trick here by being able to convert a number as a string (e.g. "123") into a string or a number as needed based on context. It's not 100% intelligent though as you can see in my "ternary" statement at the end for handling the 0 and 1 cases- I had to use n+0 to coax it into a number before comparing it to 1.
[Answer]
# Perl 5, 67+2=69 bytes
Requires the flags `-lp`.
```
$@=($,=$"=$_)-2;$,x=$,;s/./ /g;$"=$".$_ x$@.$".$/;$_=$,.$/.$"x$@.$,
```
Has all the length of a mainstream language, and the unreadability of a more esoteric language!
[Answer]
# [WC](https://wasp-compiled.firebaseapp.com/), 146 bytes
```
;>_0|;>_0|$-;>_0|;>=_0|[<]$'[>]$--[>]$--[>];>_0|$''_0|!$?#@3|//#;>(?[>]$-!!_0|;>@5|$''[<<<<]!!$?!$[>>>>>>];<?[>]##@3|/#)?##@10|[>>>>>]*$#?[>>>>]!$
```
[Try it online!](https://wasp-compiled.firebaseapp.com/?;%3E_0|;%3E_0|$-;%3E_0|;%3E=_0|[%3C]$%27[%3E]$--[%3E]$--[%3E];%3E_0|$%27%27_0|!$?#@3|//#;>(?[>]$-!!_0|;>@5|$''[<<<<]!!$?!$[>>>>>>];<?[>]##@3|/#)?##@10|[>>>>>]*$#?[>>>>]!$&16)
Ungolfed/commented:
```
;>_0|;>_0|       var n, var c
$-               decrement c
;>_0|;>=_0|      var i, var len = length(X)
[<]              move to i
$'[>]            multply i by len
$--[>]$--[>]     i -= len (x2)
;>_0|$''_0|      var full = X repeated X times
!$               print full
?                reset index
#@3|             if n == 0
  //             terminate
#                end if
;>(              new function
  ?[>]           set index to 1
  $-!!_0|        decrement c and print it
  ;>@5|          var spaces
  $''[<<<<]      repeat i times
  !!$            print spaces
  ?              reset index
  !$             print n
  [>>>>>>]       move to spaces
  ;<             delete spaces var
  ?[>]           set index to 1
  ##@3|          if c != 0
    /            restart context (this function)
  #              end if
)                end function
?                reset index
##@10|           if n != 2 (10th global)
  [>>>>>]        set index to 5
  *$             call the function
#                end if
?[>>>>]          set index to 4
!$                print full
```
[Answer]
# APL(NARS), 69 chars, 138 bytes
```
{⍵≤1:⍕⍳⍵⋄f←{⊂∊⍺/⊂⍕⍵}⋄y←((⍴⊃x←f⍨⍵)-2×⍴r←⍕⍵)f' '⋄⊃x,((⊂∊r,y,r)/⍨⍵-2),x}
```
test:
```
  g←{⍵≤1:⍕⍳⍵⋄f←{⊂∊⍺/⊂⍕⍵}⋄y←((⍴⊃x←f⍨⍵)-2×⍴r←⍕⍵)f' '⋄⊃x,((⊂∊r,y,r)/⍨⍵-2),x}
  ⎕fmt   g¨0 1 2 3 11
┌5──────────────────────────────────────────┐
│┌0┐ ┌1┐ ┌2─┐ ┌3──┐ ┌22────────────────────┐│
││ │ │1│ 222│ 3333│ 11111111111111111111111││
│└¯┘ └─┘ │22│ │3 3│ 111                  11││
│        └──┘ │333│ │11                  11││
│             └───┘ │11                  11││
│                   │11                  11││
│                   │11                  11││
│                   │11                  11││
│                   │11                  11││
│                   │11                  11││
│                   │11                  11││
│                   │1111111111111111111111││
│                   └──────────────────────┘2
└∊──────────────────────────────────────────┘
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 29 bytes
```
*zKszVSJ-K2p+z*J*lzdz)I>K1*zK
```
[Try it online!](https://tio.run/##K6gsyfj/X6vKu7gqLNhL19uoQLtKy0srpyqlStPTztsQKPP/v6EBAA "Pyth – Try It Online")
Properly handles "1" case, even if it cost me 3 more characters to do so. Still new to Pyth, and there's some interesting stuff happening with that Pyth answer that uses all the joins.
```
*zKsz        #input auto-assigned to z as string, assign K to int(z), and print z*K
VSJ-K2       #set J to K-2, for N in range J
p+z*J*lzdz   #print with no newline: z + (" " * len(z)) * (K - 2), print z
)I>K1*zK     #close for loop and print z*K if K greater than 1
```
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), 146 bytes
```
a=>{string b=a.ToString(),s="";for(int i=0,j,k;++i<=a;s+="\n")for(j=0;++j<=a;)if(i>1&i<a&j>1&j<a)for(k=0;k++<b.Length;)s+=" ";else s+=b;return s;}
```
[Try it online!](https://tio.run/##NU5Na4QwED3XXzF4WBK04rbHGKEUCoXtpVvopZfojttRm0AmLhTxt9u4Zecy876G1/J96zyuE5M9w/GXA/4oaEfDDE8wJxxMoBZeJttWZEMOHHx01tCBXo2u538MjTbFhztegZA56zRVnfMiZoB0mff5oLKMKm0UZzr9sqnc5F6Xke43WlInqN7vqDK7Pu6@MlfLEC1DllVNcUB7Dt9Kbg8gVTgyQrwb5TFM3gKrZVW3xhdHJ3gzZIWck7tnZ9mNWHx6Cig6EfEFfYiVX214fBA3/R3N6UAWhYyjkmVZ9@Uf "C# (.NET Core) – Try It Online")
Ungolfed:
```
a => {
    string b = a.ToString(), s = "";            // initialize b (saves 4 bytes) and s (return variable)
    for(int i = 0, j, k; ++i <= a; s += "\n")   // for each row of the square
        for(j = 0; ++j <= a;)                       // for each column of the square
            if(i > 1 & i < a & j > 1 & j < a)           // if not an edge of the square
                for(k = 0; k++ < b.Length;)                 // for each digit in a
                    s += " ";                                   // add a space
            else                                        // if an edge of the square
                s += b;                                     // add the input num
    return s;                                   // output the full string
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 22 bytes
```
_hUçU)z3
NgV gV gV gV
```
[Try it online!](https://ethproductions.github.io/japt/?v=1.4.6&code=Cl9oVedVKXozCk5nViBnViBnViBnVg==&input=NQotUQ==)
More competitive than I expected, though I wouldn't be surprised if Charcoal or something has a really short answer that just hasn't been found yet.
Explanation:
```
                :Empty line preserves the input as U
_hUçU)z3        :Declare a function V taking an argument Z:
_h   )          : Set the first line of Z to
    U           :  U as a string
  Uç            :  Repeated U times
      z3        : Rotate Z 90 degrees counterclockwise
NgV gV gV gV    :Main program
N               : Start with an arbitrary array (in this case [U])
 gV gV gV gV    : Apply V 4 times
```
It's necessary to rotate counterclockwise in `V` because a single-line array always ends up left-aligned when rotated, making clockwise rotations take an extra `gV`. The 1 extra byte for `z3` instead of `z` was better.
[Answer]
# Japt `-R`, 18 bytes
```
îU
U+ÕÅ+UÔÅ Õ·hJUw
```
[Test it online!](https://ethproductions.github.io/japt/?v=1.4.6&code=7lUKVSvVxStV1MUg1bdoSlV3&input=MwoKLVI=)
[Answer]
# Batch, 264 bytes
```
@echo off&setlocal enabledelayedexpansion&set o=&set m=
for /l %%i in (1,1,%1)do set o=!o!%1&if %%i gtr 2 set m=!m!%1
if %1 gtr 0 echo %o%&if %1 gtr 2 (for /l %%i in (0,1,9)do set m=!m:%%i= !
set/an=%1-2
for /l %%i in (1,1,!n!)do echo %1!m!%1)
if %1 gtr 1 echo %o%
```
Only works for numbers up to 2029 because of the length limitations of `echo`.
]


[Question]
      [
They say that `hate` is a strong word. I wanted to find out why, so I had a good look at the word.
I noticed that every consonant had a vowel after it. That made it look quite strong to me, so I decided that that's what makes a word strong.
I want to find more strong words, so I'll need a program for it!
# Finding strong words
Strong words are words where every consonant (letters in the set `BCDFGHJKLMNPQRSTVWXZ`) is followed by a vowel (letters in the set `AEIOUY`). That's it. Nothing else matters.
If the word starts with a vowel, you don't have to worry about any of the letters before the first consonant. If the word has no consonants in it at all, it's automatically a strong word!
Some examples of strong words are `agate`, `hate` and `you`. `agate` is still a strong word because although it starts with a vowel, every consonant is still followed by a vowel. `you` is a strong word because it has no consonants.
There is no restriction on length for strong words.
# The challenge
Write a program or function that takes a non-empty string as input, and outputs a truthy value if it is a strong word or a falsy value if it is not.
# Clarifications
* You may decide to take the input in either lowercase or uppercase. Specify which in your answer.
* Words will not contain punctuation of any kind. They will only contain plain letters in the set `ABCDEFGHIJKLMNOPQRSTUVWXYZ`.
* Instead of truthy and falsy values, you may choose two distinct and consistent values to return for true and false. If you do this, specify the values you have picked in your answer.
	+ You may alternatively output a falsy value for a strong word and a truthy one for a non-strong word.
# Test cases
```
Input      -> Output
hate       -> true
love       -> true
popularize -> true
academy    -> true
you        -> true
mouse      -> true
acorn      -> false
nut        -> false
ah         -> false
strong     -> false
false      -> false
parakeet   -> false
```
# Scoring
Since this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), the answer with the least bytes wins!

[Answer]
# JavaScript (ES6), ~~36~~ ~~28~~ 27 bytes
*Saved 1 byte by inverting the result, as suggested by LarsW*
Takes input in lowercase. Returns `false` for a strong word and `true` for a non-strong word.
```
s=>/[^aeiouy]{2}/.test(s+0)
```
### How?
We append a `0` (non-vowel) at the end of the input string and look for two consecutive non-vowel characters. This allows us to cover both cases that make a word *not* strong:
* it contains two consecutive consonants
* *or* it ends with a consonant
### Test cases
```
let f =
s=>/[^aeiouy]{2}/.test(s+0)
;[
  "hate", "love", "popularize", "academy", "you", "mouse", "a", "euouae",
  "acorn", "nut", "ah", "strong", "false", "parakeet"
]
.forEach(s => console.log(s + ' --> ' + f(s)))
```
[Answer]
# [Python 2](https://docs.python.org/2/), 48 bytes
```
lambda s:'se, F'in`[v in'aeiouy'for v in s+'b']`
```
An unnamed function taking a (lowercase) string, `s`, and returning `False` if strong or `True` if not.
**[Try it online!](https://tio.run/##JY7BCsIwEETP@hVLoKzFetCjoEd/QgVXm9pgmw3JplB/Pib1Mm9m2IVxs/RsD6k73dJA47MlCEcMuoELGvu4TmAskjYcZ@zYQ8kQtvjE@yOVQnSQ0m1UT6JVowaeChy7OJA33xLoRa0e5@xmjllHjuHfs7eZNkpJfZYgnu07m46G5caRp4/WourjeuW8sQKq2h8C7M5QBQUVbMqGBrqFNdkWcHlGyPtQfNRYp/QD "Python 2 – Try It Online")** (inverts the results to match the OP)
### How?
Non-strong words have either a consonant followed by a consonant or end in a consonant.
The code adds a consonant to the end (`s+'b'`) to make the required test be just for two consonants in a row.
It finds out if each letter in the altered word is a vowel with the list comprehension `[v in'aeiouy'for v in s+'b']`.
It now needs to check for two `False` results in a row (signalling a non-strong word), it does so by getting a string representation (using ``...``) of this list and looking for the existence of `'se, F'`. This is the shortest string found in `'False, False'` but none of: `'True, True'`; `'False, True'`; or `'True, False'`.
As an example consider `'nut'`, the list comprehension evaluates each letter, `v`, of `'nutb'` for existence in `'aeiouy'` yielding the list `[False, True, False, False]`, the string representation of this list is `'[False, True, False, False]'` which contains `'e, F'` here: `'[False, True, Fals>>e, F<<alse]'` hence the function returns `True` meaning that nut is **not** a strong word.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~10~~ 9 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
e€ØY;Ạ11ẇ
```
A monadic link taking a list of characters and returning:
* `0` if strong
* `1` if not
**[Try it online!](https://tio.run/##y0rNyan8/z/1UdOawzMirU8sMzR8uKv9////5flFKQA "Jelly – Try It Online")** or see the [test-suite](https://tio.run/##y0rNyan8/z/1UdOawzMirR/uWmBo@HBX@//D7Q93dz9qmJOWmFOcCqRLikqB1Fyuh7u3HN1zuB2oXMX9//@MxJJUrpz8slSugvyC0pzEosyqVK7E5MSU1NxKrsr8Uq7c/NJikEh@UR5XXmkJV2IGV3FJUX5eOhfYYK6CxKLE7NTUEgA "Jelly – Try It Online").
### How?
```
e€ØY;Ạ11ẇ - Link: list of characters, s      e.g. "hate"  or  "you"  or  "not"
  ØY      - consonant yield                   "BCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz"
e€        - exists in? for €ach letter            [1,0,1,0]   [0,0,0]    [1,0,1]
     Ạ    - all truthy? (1 for any valid input)   1           1          1
    ;     - concatenate                           [1,0,1,0,1] [0,0,0,1]  [1,0,1,1]
      11  - literal eleven
        ẇ - sublist exists?                       0           0          1
          -  N.B.: left of ẇ implicitly makes digits so it looks for the sublist [1,1]
```
Note: The reason for using `Ạ` is just to save a byte over using `1` (since we then want to use `11` straight away).
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 8 bytes
### Code
```
žPS¡¦õÊP
```
Uses the **05AB1E** encoding. [Try it online!](https://tio.run/##MzBNTDJM/f//6L6A4EMLDy07vPVwV8D//4npiSWpAA "05AB1E – Try It Online")
### Explanation
```
žPS¡         # Split the string on consonants (bcdfghjklmnpqrstvwxz)
    ¦        # Remove the first element of the array to handle cases when the
               string starts with a consonant
     õÊP     # Check if the empty string is not in the array
```
### Example
```
             # "popularize"
žPS¡         # ['', 'o', 'u', 'a', 'i', 'e']
    ¦        # ['o', 'u', 'a', 'i', 'e']
     õÊ      # [1, 1, 1, 1, 1]
       P     # 1
```
[Answer]
# [R](https://www.r-project.org/), 43 bytes
```
function(s)grep("[^aeiouy]{2}",paste(s,""))
```
[Try it online!](https://tio.run/##K/qfZvs/rTQvuSQzP0@jWDO9KLVAQyk6LjE1M7@0MrbaqFZJpyCxuCRVo1hHSUlT83@ahlJiemJJqpImF5BZmV8KYSTl52dDWBlwSaBZqXlKmv8B "R – Try It Online")
A port of Arnauld's JavaScript answer; returns 1 for weak words and `integer(0)` for strong ones; it appends a  (space) to the end of the string.
This is actually vectorized; with a vector of strings, it returns the indices (1-based) of the weak words.
[Answer]
# Dyalog APL, 20 bytes
```
⎕←∧/2∨/0,⍨⍞∊'aeiouy'
```
[Try it online!](https://tio.run/##ATwAw/9hcGwtZHlhbG9nLWNsYXNzaWP//@KOleKGkOKIpy8y4oioLzAs4o2o4o2e4oiKJ2FlaW91eSf//2hhdGU)
[Answer]
# [Haskell](https://www.haskell.org/), ~~61~~ 54 bytes
```
f=and.(zipWith(||)=<<tail).(map(`elem`"aeiouy")).(++"z")
```
[Try it online!](https://tio.run/##JYpBDoMgEEXX7SnIrCA2nkCP0HUXTRMndSxEYAiCica7U2w3/7//8jUuM1lbytSjH1u5m/AwScvjUH3XJTRWtdJhkANZcgMgGc4bqGqbBnZQxaHxohcjXy/1dxcyRONTOynxBI2J4AaW17MCh2wxmv0c@MaR3FZp41zTcV7@nqOv7XM6l66xpMj@U2FC@/sEjDgTJXiVLw "Haskell – Try It Online")
I had to add a `z` at the end of the string to handle the case of a trailing consonant.
[Answer]
# [Husk](https://github.com/barbuz/Husk), 12 bytes
```
ΛΣX_2m€¨γaıu
```
[Try it online!](https://tio.run/##ASMA3P9odXNr///Om86jWF8ybeKCrMKozrNhxLF1////ImFnYXRlIg "Husk – Try It Online")
Thanks to [H.PWiz](https://codegolf.stackexchange.com/users/71256/) for help with -4. ~~Returns inconsistent but appropriately truthy or falsy values.~~
Thanks to [Leo](https://codegolf.stackexchange.com/users/62393/leo) for -1, now returns consistent truthy/falsy value.
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), ~~93~~ 81 bytes
```
s->{int w=0,p=w,l;for(char c:s)w|=p&(p=l="aeiouy".indexOf(c)>>31);return w+p>=0;}
```
[Try it online!](https://tio.run/##LY6xTsMwFEX3fIWVAdmQWkVspI4ESGyIoWPV4eE4xaljW/ZzQ1Ty7cFBvePVubqnhwtsnFe2b8@LHrwLSPrc8YTa8C5ZidpZfl8XhTQQI/kAbcm1IDkRAbUk7zdoJ78hHI7Vq3NGgW1IJ5a4aa7aIhnFtvJirEzduUBXkMjnyMZf4e@oF0aUoLRLU8m1bdXPZ0cla5qnR1YHhSlYMj74Rmzrecki67dPXyZ/3xQuTrdkyGZ0j0Hb0@FIIJwiu4mu2U8R1cBdQu4zgsbSjoP3ZqKlhwBnpbDk6N6y20sIMFHGWP0/n4t5@QM "Java (OpenJDK 8) – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 25 bytes
```
->w{w+?t!~/[^aeiouy]{2}/}
```
[Try it online!](https://tio.run/##LYpBDoIwFESvUklIF4JEE5fiQZqafLUIEfhN2y9UwKvXFN3MvJcZQ1cfqlPIy2Eatme3@RTiAqpB8nI6LMUSBK/BKZ4x3uJrbY2aWjDNezW4wV11PqJHitUh2f@Epo/Qk1u9jmmdwf4RqYL2d9Rg4KmU43LXgZ7mcdbkLEvS/dGyvGSpTVIxZpUYpVzCFw "Ruby – Try It Online")
Everybody else is doing it, so why can't Ruby?
[Answer]
# [Pyth](https://pyth.readthedocs.io), 18 bytes
```
:+Q1."2}M>åYà
```
**[Verify all the test cases.](https://pyth.herokuapp.com/?code=%3A%2BQ1.%222%7D%04M%C2%83%3E%C2%85%C3%A5Y%13%C3%A0%C2%9B&test_suite=1&test_suite_input=%22hate%22%0A%22love%22%0A%22popularize%22%0A%22academy%22%0A%22you%22%0A%22mouse%22%0A%22acorn%22%0A%22nut%22%0A%22ah%22%0A%22strong%22%0A%22false%22%0A%22parakeet%22&debug=0)**
"Borrowed" the regex from [the JS answer](https://codegolf.stackexchange.com/a/142279/59487). This returns `False` for strong words, `True` otherwise
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), ~~18~~ ~~11~~ 10 bytes
```
,Ḷs₂{¬∈Ẉ}ᵐ
```
[Try it online!](https://tio.run/##LY07DsIwEESvsnJB5YrrIIpN4nyE4438iRQ@TQoUOg5CQQNCKbmJc5EQmzQ7b2Z2tYnGtOwkFdv5NF2fU99vOIOMhAFFFkQrFMgqtxwSTcyPt/NSVwaM1aSKEFz86z5z/3mb5fj0fUzD4MchpvMOWIlWMA5MUhu1ocZJ1NUxOkwxE3UXsCMXpCZn1oq0CqCcjb4Mc/27UI7yv9igxoMQlsH@Bw "Brachylog – Try It Online")
Neat and simple (except maybe for the 2 extra initial bytes to handle the final consonant case, like "parakeet").
Is falsey for strong words and truthy for non-strong words.
```
,Ḷ               % append a newline (non-vowel) at the end of input,
                 %   to catch final consonants
     s₂          % the result has some substring of length 2
       {¬∈Ẉ}ᵐ    % where neither of its elements belong to
                 %   the set of alternate vowels (with "y")
```
[Answer]
# Perl 5, 31 bytes (30 + 1)
```
$_=''if/[^aeiouy](?![aeiouy])/
```
+1 byte for `-p` command line flag. Prints the word if it's a strong word, or the empty string if it is not.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 11 bytes
```
e€ØY;1a2\¬Ȧ
```
[Try it online!](https://tio.run/##y0rNyan8/z/1UdOawzMirQ0TjWIOrTmx7P///4nJ@UV5AA "Jelly – Try It Online")
```
e€ØY;1a2\¬Ȧ  Main link
 €           For each letter
e            Is it an element of
  ØY         The consonants (excluding Yy)?
    ;1       Append 1 (true) (consonant) to make sure last letter isn't consonant
       2\    For all (overlapping) slices of length 2 (the <link><nilad>\ functionality)
      a      Logical AND of the two values; is it a consonant pair?
         ¬   Logical NOT vectorizing; for each (overlapping) pair, is it not a consonant pair?
          Ȧ  Any and all; make sure all pairs are not consonant pairs
```
Yes I know I've been beaten a lot by Jonathan Allan but I wanted to share my approach anyway :P
-4 bytes by stealing a little bit of Jonathan Allan's answer (instead of appending a consonant to check for last-letter edge case, just append 1)
-1 byte thanks to miles
[Answer]
# Awk, 39 bytes
```
/([^aeiouy]{2}|[^aeiouy]$)/{print "n"}
```
prints `n` for non-strongword, nothing (or, just a newline) for strongword
following the pack and searching for two consecutive non-vowels on lowercase input
testing
```
$ awk -f strongwork.awk
hate
love
popularize
academy
you
mouse
acorn
n
nut
n
ah
n
strong
n
false
n
parakeet
n
```
[Answer]
# [Kotlin](https://kotlinlang.org), 49 bytes
```
{Regex(".*[^aeiouy]([^aeiouy].*|$)").matches(it)}
```
**True and false are swapped**
## Beautified
```
{
    Regex(".*[^aeiouy]([^aeiouy].*|$)").matches(it)
}
```
## Test
```
var s:(String)->Boolean =
{Regex(".*[^aeiouy]([^aeiouy].*|$)").matches(it)}
data class TestData(val input: String, val output: Boolean)
fun main(args: Array<String>) {
    val items = listOf(
            TestData("hate", true),
            TestData("love", true),
            TestData("popularize", true),
            TestData("academy", true),
            TestData("you", true),
            TestData("mouse", true),
            TestData("acorn", false),
            TestData("nut", false),
            TestData("ah", false),
            TestData("strong", false),
            TestData("false", false),
            TestData("parakeet", false)
    )
    items
            .filter { s(it.input) == it.output }
            .forEach { throw AssertionError(it.toString()) }
    println("Test Passed")
}
```
[TryItOnline](https://tio.run/##jZLBTsMwDIbvfQqr4pBMow8w0UlD7AwCbggka0vbaGlSOc6gjD17SVsYAmkqviR2vt@2lH/n2Gjb7ZHAL8QDk7alvFxeO2cUWsi7w70q1ZtIs9nTCyrtQvssTrds9nEhU5nVyJtKeaFZHrstMsLGoPfwqDzfxFTs0YC2TeAFjDPm0Jdc4KH2NU4mSREs1KitQCr9AlZE2F6NkqWEQwIxhmasag85GO35thBD/TtOU9MKWaVzYApKzs8wxu0nmcY1wSDp90kSN7hVdTuFtS5MIbUL/h/jHNkIFWj8ecoGnmSwmkQ8k7PlJDa8TlINEu6U@lls4KID@mP43V/CrNCGFcEBepdlg5ck5HlEs9FFcPwjcLTGTRUVXJF7hZX3ilg7uyZy1DdhNxpLSBnFg7qJORsr0n5RuIseVttUJsfuEw)
Based on [@Arnauld's](https://codegolf.stackexchange.com/users/58563/arnauld) [Answer](https://codegolf.stackexchange.com/questions/142278/is-it-a-strong-word/142279#142279)
[Answer]
# [Retina](https://github.com/m-ender/retina), ~~23~~ 18 bytes
```
$
$
1`[^aeiouy]{2}
```
[Try it online!](https://tio.run/##HclBCsIwEAXQ/T9HhW71Eh5ClH50akPTTJjOCEE8exS375l4KuyH8Tz1AQOO0@VGSRrt@j59el/ogqwvQdUamZZ2Ae98yNbQNLBp/EWtoISDC3Y3LU/MzL@pNK4i/gU "Retina – Try It Online") Outputs 0 for strong, 1 if not. Add 1 byte to support mixed case. Edit: Saved 5 bytes thanks to @ovs.
[Answer]
# Java 8, ~~53~~ 42 bytes
```
s->s.matches(".*[^aeiouy]([^aeiouy].*|$)")
```
-11 bytes by using the same regex as in [*@jrtapsell*'s Kotlin answer](https://codegolf.stackexchange.com/a/142332/52210) instead.
[Try it here.](https://tio.run/##jZDBbsIwDIbvPIVV7dAgkReotjcYF44IJBMMDaRxlTiVuq3P3oXBdtsyKZYS/Z/9//EFB1xxT/5yvM7GYYzwita/LwCsFwonNATr2xPgwOwIPZh6I8H6M0TVZGHKlU8UFGtgDR6eYY6rl6g7FNNSrCu93O6RLKdxV//c9PLjSVVqbu79fTq43P8YM7A9QpeTPLy2O0B1j7EZo1CnOYnusyTO116bumpRqFJfkX6HHA9lqOc@OQz2rYyiwSN1Y5EbORWZjlP801E1N6GQh4MvOvkk5Z@1RSRKYH8uYid08R9Lx4BXou9g02KaPwE) (`false` if strong; `true` if not)
**Explanation:**
```
s->               // Method with String parameter and boolean return-type
  s.matches(      //  Checks if the String matches the following regex:
    ".*           //   One or more characters
     [^aeiouy]    //   Followed by a consonant
     ([^aeiouy].* //   Followed by another consonant (+ any more characters)
      |$)")       //   Or the end of the String
                  // End of method (implicit / single-line return statement)
```
So it basically checks if we can find two adjacent consonants, or if the String ends with a consonant.
---
Old answer (**53 bytes**):
```
s->s.matches("[aeiouy]*([a-z&&[^aeiouy]][aeiouy]+)*")
```
[Try it here.](https://tio.run/##jZBBboMwEEX3OcWIRYQTwQVQe4NmkyWi0sQ4wYnxII@NRCrOTp2GLFtX8izs//T/91xxxIIGZa/tbZEGmeEDtf3aAGjrlTujVHB4XAFOREahBZkfvdP2AiyqKMxx4mGPXks4gIU3WLh457JHLzvFeVaj0hSmZpfXWNy32/pzfWheyl7sMrFUT6shnEy0Wh1H0i30sdQaWzeA4tnoOLFXfUnBl0OUvLG5LWWedehVJn7a/Q4ZGtPQQEMw6PQ9jaLEVvVTkpsoJJmeAv@ZKKqHkOhDziaTbPDpn3VJhL0je0liZzT8j6Wjw5tSr2LzZl6@AQ) (`true` if strong; `false` if not)
Uses regex to see if the input-String matches the 'strong'-regex. Note that `String#matches` in Java automatically adds `^...$` to check if the String entirely matches the given regex.
**Explanation":**
```
 s->                   // Method with String parameter and boolean return-type
  s.matches(           //  Checks if the String matches the following regex:
    "[aeiouy]*         //   0 or more vowels
    ([a-z&&[^aeiouy]]  //     { A consonant,
     [aeiouy]+)        //       plus one or more vowels }
    *")                //    Repeated 0 or more times
                       // End of method (implicit / single-line return statement)
```
---
A search instead of matches (like a lot of other answers use) is actually longer in Java:
**70 bytes**:
```
s->java.util.regex.Pattern.compile("[^aeiouy]{2}").matcher(s+0).find()
```
[Try it here.](https://tio.run/##jZBBasMwEEX3OcXglUWJKN2a9gYNhSxDChN54iiRNUYahbrBZ3eVJl22KkgLMY//3@iIZ1zyQP7YnmbjMEZ4ResvCwDrhcIeDcHq@gTYMTtCD6ZeS7C@g6iaPJjyzScKijWwAg/PMMflyzFH6yTW6UAdfeg3lBzoteF@sI7qavOOZDmN28vTVCndo5gDhTo@PCq9t76t1dzcsoe0czn7XnFm20KfLe8emy2guimuxyjUa06ihzwS5@tcWFcHFKrUt@7vkONzGRp4SA6D/SyjaLClfixyI6ci03OKfzaq5joo@HDwxSafpLzZoYhECey7IrZHF//x6RjwRPQjNi2m@Qs) (`false` if strong; `true` if not)
[Answer]
# [Python 2](https://docs.python.org/2/), 58 bytes
*-30 bytes by realizing it can be as simple as [Arnauld's JS answer](https://codegolf.stackexchange.com/a/142279/68615).*
```
lambda s:re.search('[^aeiouy]([^aeiouy]|$)',s)<1
import re
```
[Try it online!](https://tio.run/##PY7BCsIwEETv/Yo9CGlBBD0W@yW1wtpubbDNhs1GqPjvkVTxMvOGmcP4VSd2pzQ2lzTjchsQQi10CITST6Vpr0iW49qVf3rvKrMP1flY2MWzKAglpaABGmjNhEpmD2bm5@aefZxR7GtL2ONAy5px5Zht4Rh@FYvL4KJuecoaVNjdM404f4ceBR9EarqiGFnAgnWwHajBi3UKY2mr9AE "Python 2 – Try It Online")
[Answer]
# [SOGL V0.12](https://github.com/dzaima/SOGL), ~~19~~ 18 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md)
```
æ"[^ŗy]”ŗ(ŗ|$)”øβ=
```
[Try it Here!](https://dzaima.github.io/SOGLOnline/?code=JUU2JTIyJTVCJTVFJXUwMTU3eSU1RCV1MjAxRCV1MDM5ODFnJTI1JXUwMTdFSiV1MjAxOCVGOCV1MDNCMiUzRA__,inputs=cG9wdWxhcml6ZQ__)
Explanation:
```
æ                   push "aeiou"
 "[^ŗy]”            push "[^ŗy]" with ŗ replaced with pop
        ŗ(ŗ|$)”     push `ŗ(ŗ|$)` with ŗ replaced with pop
               øβ   replace in the input that regex with nothing
                 =  check for equality with the original input
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 11 bytes
```
žP¹SåJ1«11å
```
[Try it online!](https://tio.run/##MzBNTDJM/f//6L6AQzuDDy/1Mjy02tDw8NL//xPTE0tSAQ "05AB1E – Try It Online")
Uses Jonathan's algorithm, returns `0` for true and `1` for false.
[Answer]
# [Swift 3.1](https://www.swift.org), 85 bytes
```
import Foundation
{($0+"0").range(of:"[^aeiouy]{2}",options:.regularExpression)==nil}
```
**[Try it here!](http://swift.sandbox.bluemix.net/#/repl/59b513d36bb1b17773ce606b)**
This borrows [Arnauld's regex](https://codegolf.stackexchange.com/a/142279/59487).
[Answer]
# Lua, 41 bytes
```
return#(io.read()..0):match"[^aeiouy]+"<2
```
Reads from standard input
# Lua (loadstring'ed), 37 bytes
```
return#((...)..0):match"[^aeiouy]+"<2
```
Reads from function parameter(s)
---
Input is lowercase
Sees if there is a string of length 2 or more, consisting only of not vowels (consonants) or if the string ends with a non-vowel
Returns true/false
[Answer]
## C++, ~~195~~ 194 bytes
-1 bytes thanks to Zacharý
Uppercase, return true if input is a strong word, false otherwise ( C++ have simple int to bool implicit cast rules, 0 => false, true otherwise )
```
#include<string>
#define C(p)(v.find(e[p])==size_t(-1))
std::string v="AEIOUY";int s(std::string e){for(int i=0;i<e.size()-1;++i)if(e[i]>64&&e[i]<91&&C(i)&&C(i+1))return 0;return!C(e.size()-1);}
```
**Code to test :**
```
auto t = {
    "HATE",
    "LOVE",
    "POPULARIZE",
    "ACADEMY",
    "YOU",
    "MOUSE",
    "ACORN",
    "NUT",
    "AH",
    "STRONG",
    "FALSE",
    "PARAKEET"
};
for (auto&a : t) {
    std::cout << (s(a) ? "true" : "false") << '\n';
}
```
[Answer]
# C, 107 Bytes
```
i,v,w,r,t;a(char*s){w=0;for(r=1;*s;s++){v=1;for(i=6;v&&i;)v=*s^" aeiouy"[i--];r=w&&v?0:r;w=v;}return r&~v;}
```
Returns 1 for *strong* word and 0 for *weak* word. Tested with the words given in the main post.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 59 bytes
```
f(char*s){return*s?strcspn(s,"aeiouy")+!s[1]<2?f(s+1):0:1;}
```
[Try it online!](https://tio.run/##PVDBbsMgDD3DVzCmSpBkU7Nj060/UO22U5cDIqRBSyDCMCmr8u0ZKdlOfrafn58tn65SLkvLZCdcBvzmlA/OZHAC7ySMhkFBhdI2TJTnD3Ap6@PLqWWQl/ywP5TVvDxqI/vQKHIE32j73L1hbTwZhDaMkxtG0hrwZF1AsoThUpPXtYVoJ7yixYp6@72h0Y6hF07/bLmQolHDlJLJhgQGG@CfYJ1J0AS/1Tq6hniGNddUakX/NzEKJ76UStz3j/MZo7nCqLWOsNW9jv72VTSq64roPL8fgkYXey2ju3IPZNd8xp13SkHiR2LkPGrMGKUnRgE8L78 "C (gcc) – Try It Online")
[Answer]
# **PHP, 69 bytes**
```
preg_match("/([^AEIOUY][^AEIOUY]+|[^AEIOUY]$)/",$_SERVER['argv'][1]);
```
Returns **1** is the word is not strong.
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 57 bytes
```
q{"aeiouy"#W=}%_,:B{_A={_A_)\B(<{=!X&:X;}{0:X;;;}?}&}fA;X
```
[Try it online!](https://tio.run/##S85KzP3/v7BaKTE1M7@0Ukk53LZWNV7Hyqk63tEWiOM1Y5w0bKptFSPUrCKsa6sNgKS1da19rVptmqN1xP//ufmlxakA "CJam – Try It Online")
---
Reads input, converts to 1s for consonants, 0s for vowels. For every consonant, AND predefined variable X (predefined to 1) with next character's value. Output X
[Answer]
# [Zsh](https://www.zsh.org/), 21 bytes
```
>$1x<*[^aeiouy](#c2)*
```
[Attempt This Online!](https://ato.pxeger.com/run?1=JckxCsIwFIDhvad4YIe24FAnh6AHEYVn-9IW07yQvEjrVVwC4uTsYbyNYqcfvv_-uIU-fXQgYSdAk5Btqe0MnzPNHmooehQCw1cCxy4a9EMgwAZbGmeYOcLI8S_sLdgogD0E8Ww70Gh-x6HHC5GUxTOKXm_fu7yeVHU4IQ0c52OxajZltbyXUirfZ36EqlwkpaVf)
Same method everyone else is using. Outputs via exit code: 1 for strong, 0 for not strong. Requires the `extendedglob` option.
]