Sharkovskii order by msk

n=1
a=gets(p).map(&:to_i).sort
a.reject!{|i|i%n>0&&i>n&&!p(i)}while 99>n*=2
$><<a.reverse*$/

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top