Skip to content

Instantly share code, notes, and snippets.

@timhuff
Last active September 12, 2016 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timhuff/c12e51d95f6a303c6cae2947c9437d24 to your computer and use it in GitHub Desktop.
Save timhuff/c12e51d95f6a303c6cae2947c9437d24 to your computer and use it in GitHub Desktop.
l=Math.log;r=((n)->z=[0..l(n)/l 2].reduce(((a,b)->`1<<b&n?3+a:4+a`),0);`z==n?n:r(z)`);c={};[1..1000000].map((n)->c[r n]?=0;c[r n]++);c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment