Skip to content

Instantly share code, notes, and snippets.

@jld
Created June 26, 2013 21:33
Show Gist options
  • Select an option

  • Save jld/5871924 to your computer and use it in GitHub Desktop.

Select an option

Save jld/5871924 to your computer and use it in GitHub Desktop.
function f(x) { let y = 0; while (x > 1) { if (x % 2 == 0) x /= 2; else x = x * 3 +1; ++y; } return y; }
function g(a, b) { let t = 0; for(let i = a; i < b; ++i) { t+=f(i); } return t; }
function h() { let n = 0; for(;;) { print(g(n*10000, (n+1)*10000)); ++n; } }
h();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment