Created
September 2, 2016 00:48
-
-
Save vznvzn/b72018df488145687f167b14d9823959 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
def f1(n) | |
n = (n * 3 + 1) / 2 while (n % 2 == 1) | |
n /= 2 while (n % 2 == 0) | |
return n | |
end | |
def seq2(n) | |
l = [n] | |
n1 = n | |
l << (n = f1(n)) while (n >= n1 && n != 1) | |
return l | |
end | |
l = File.open('grow2.txt').readlines | |
l2 = [] | |
l[-10..-1].each\ | |
{ | |
|x| | |
l1 = Kernel.eval(x) | |
l1.each \ | |
{ | |
|z| | |
n = z['n'] | |
l2 << n.to_s(2).reverse | |
} | |
} | |
i = -1 | |
begin | |
i += 1 | |
s = l2.map { |x| x[i,1] }.join | |
c = s.split('').uniq.size | |
end while (c == 1) | |
p(i) | |
l2.each { |x| p(x[i..-1]) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment