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
require 'statsample' | |
def outin(fn) | |
l = (f = File.open(fn)).readlines | |
f.close | |
raise if (l.shift.chop != '$dat << eof') | |
k = l.shift.split | |
i = l.index("eof\n") | |
raise if (i.nil?) |
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 f2(n) | |
return n.odd? ? (n * 3 + 1) / 2 : n / 2 | |
end | |
def seq(n) | |
l = [n] | |
while (n != 1) | |
n = f2(n) |
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
require 'statsample' | |
def outin(fn) | |
l = (f = File.open(fn)).readlines | |
f.close | |
raise if (l.shift.chop != '$dat << eof') | |
k = l.shift.split | |
i = l.index("eof\n") | |
raise if (i.nil?) |
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 outin(fn) | |
l = (f = File.open(fn)).readlines | |
f.close | |
raise if (l.shift.chop != '$dat << eof') | |
k = l.shift.split | |
i = l.index("eof\n") | |
raise if (i.nil?) | |
l[i..-1] = [] |
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 f2(n) | |
return n.odd? ? (n * 3 + 1) / 2 : n / 2 | |
end | |
def seq(n) | |
l = [n] | |
while (n != 1) | |
n = f2(n) |
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 f2(n) | |
return n.odd? ? (n * 3 + 1) / 2 : n / 2 | |
end | |
def seq(n) | |
l = [n] | |
while (n != 1) | |
n = f2(n) |
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 f2(n) | |
return n.odd? ? (n * 3 + 1) / 2 : n / 2 | |
end | |
def seq(n) | |
l = [n] | |
while (n != 1) | |
n = f2(n) |
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 f2(n) | |
return n.odd? ? (n * 3 + 1) / 2 : n / 2 | |
end | |
def seq(n) | |
l = [n] | |
while (n != 1) | |
n = f2(n) |
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 f2(n) | |
return n.odd? ? (n * 3 + 1) / 2 : n / 2 | |
end | |
def seq(n) | |
l = [n] | |
while (n != 1) | |
n = f2(n) |
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 f2(n) | |
return n.odd? ? (n * 3 + 1) / 2 : n / 2 | |
end | |
def adj(x, m, n, s2, p2, p, x3) | |
s2.replace(p[0...x] + (x3 % 2).to_s) | |
m = (s2[x, 1] == p[x, 1]) | |
n = p2.reverse.to_i(2) | |
p2[x, 1] = m ? '11' : '01' |