def anynacci(start_sequence, count)
  n      = start_sequence.length    
  result = start_sequence.dup       
  (count-n).times do                
    result << result.last(n).sum    
  end
  result                       
end

naccis = { lucas:      [2,1],
           fibonacci:  [1,1],
           tribonacci: [1,1,2],
           tetranacci: [1,1,2,4],
           pentanacci: [1,1,2,4,8],
           hexanacci:  [1,1,2,4,8,16],
           heptanacci: [1,1,2,4,8,16,32],
           octonacci:  [1,1,2,4,8,16,32,64],
           nonanacci:  [1,1,2,4,8,16,32,64,128],
           decanacci:  [1,1,2,4,8,16,32,64,128,256] }

naccis.each {|name, seq| puts  % [name, anynacci(seq, 15)]}