Last active
August 18, 2017 22:07
-
-
Save bitmappergit/ac5de02b16b53f7bddb84f7b284bc712 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set variables for counting | |
n = 1_i64 | |
x = 1_i64 | |
y = 1_i64 | |
loop do | |
n = x+1 | |
puts "---start---" | |
puts n #this prints the current iteration number and the start comment | |
y = n | |
puts "---start---" | |
until n == 1 #this actually does the equasion until n becomes 1 | |
if n.even? | |
n = n/2 | |
puts n #this prints the current result after doing n/2 | |
else | |
n = (n*3)+1 | |
puts n #this prints the current result after doing (n*3)+1 | |
end | |
end | |
puts "----end----" | |
puts y #this prints the current iteration number and the end comment | |
puts "----end----" | |
x = x+1 | |
sleep (0.01) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment