I was messing around representing integers using binary trees, and noticed that a certain tree format makes it trivial to grep for prime numbers. Probably not very novel, but thought y'all might enjoy it. Here's one through sixteen:<p><pre><code> * (()())
* ((()())())
* (((()())())())
(((()())())(()()))
* ((((()())())())())
((((()())())())(()()))
* ((((()())())(()()))())
((((()())())(()()))(()()))
((((()())())(()()))((()())()))
((((()())())(()()))(((()())())()))
* (((((()())())())())())
(((((()())())())())(()()))
* (((((()())())())(()()))())
(((((()())())())(()()))(()()))
(((((()())())())(()()))((()())()))
(((((()())())())(()()))(((()())())()))
</code></pre>
I added asterisks in front of the primes. Here's the set of 16-bit ints:<p><a href="https://gist.github.com/cieplak/213fb4c88581d8971b274b7ec64787b1" rel="nofollow">https://gist.github.com/cieplak/213fb4c88581d8971b274b7ec647...</a><p>The regex just checks if the string ends with '())':<p><pre><code> cat integers.txt | grep '())$' | nl | tail -1</code></pre>