Ruby
A030717
A030717
出力してみた。
def A(n)
p ary = [1]
(n - 1).times{
p a = ary.uniq.sort.map{|i| ary.count(i)}
ary += a
}
ary
end
A(20)
出力結果
[1]
[1]
[2]
[2, 1]
[3, 2]
[3, 3, 1]
[4, 3, 3]
[4, 3, 5, 1]
[5, 3, 6, 2, 1]
[6, 4, 7, 2, 2, 1]
[7, 6, 7, 3, 2, 2, 1]
[8, 8, 8, 3, 2, 3, 3]
[8, 9, 11, 3, 2, 3, 3, 3]
[8, 10, 15, 3, 2, 3, 3, 4, 1, 1]
[10, 11, 18, 4, 2, 3, 3, 5, 1, 1, 1, 1]
[14, 12, 20, 5, 3, 3, 3, 5, 1, 2, 2, 1, 1]
[17, 14, 23, 5, 5, 3, 3, 5, 1, 2, 2, 1, 1, 1, 1, 1]
[23, 16, 25, 5, 8, 3, 3, 5, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1]
[30, 19, 27, 5, 10, 3, 3, 6, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1]
[38, 23, 29, 5, 11, 4, 3, 6, 1, 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1]
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。