Skip to content

Instantly share code, notes, and snippets.

@vznvzn
Created September 2, 2016 00:48
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 vznvzn/b72018df488145687f167b14d9823959 to your computer and use it in GitHub Desktop.
Save vznvzn/b72018df488145687f167b14d9823959 to your computer and use it in GitHub Desktop.
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