(x=scan())%in%(2*4^(n=0:x)-2^n-1)
One challenge on code golf is to find the shortest possible code to identify whether or not an integer belongs to the binary cyclops numbers which binary expansion is 0, 101, 11011, 1110111, 111101111, &tc. The n-th such number being this leads to the above solution in R (26 bits). The same length as the […]
[Read more...]