Skip to content

Instantly share code, notes, and snippets.

@rakeybulhasan
Created April 29, 2013 08:27
Show Gist options
  • Save rakeybulhasan/5480361 to your computer and use it in GitHub Desktop.
Save rakeybulhasan/5480361 to your computer and use it in GitHub Desktop.
<script>
var n= prompt('Please enter the value','');
var i=1;
document.write(n);
document.write(" For ");
while(n != 1)
{
if(n % 2 == 0)
{
n=n/2;
}
else
{
n = (3*n)+1;
}
i++;
}
document.write(i)
</script>
@roniemicro
Copy link

This implementation is not fully correct!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment