def hmean(x) sum=0 x.each {|v| sum += (1.0/v)} x.size/sumenddata = [1.1,2.3,3.3,1.2,4.5,2.1,6.6 ]puts hm = hmean(data) # 2.101997946