Skip to content

Instantly share code, notes, and snippets.

@gsmcwhirter
Last active October 12, 2015 14:52
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 gsmcwhirter/a91a5442f37e6692ada7 to your computer and use it in GitHub Desktop.
Save gsmcwhirter/a91a5442f37e6692ada7 to your computer and use it in GitHub Desktop.
public void mystery(int n)
{
while ( n > 1)
{
if (n % 2 == 0){
n /= 2;
}
else {
n = 3 * n + 1;
}
System.out.println(n);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment