We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents fd0bf20 + b83af61 commit c830fa4Copy full SHA for c830fa4
math/geometric_progression.rb
@@ -0,0 +1,6 @@
1
+def geometric_progression initial, ratio, numbers
2
+ (numbers - 1).times.inject([initial]){|array| array << array.last * ratio}
3
+end
4
+
5
+puts "geometric_progression(2, 2, 10): #{geometric_progression(2, 2, 10)}"
6
+puts "geometric_progression(2, 0.5, 10): #{geometric_progression(2, 0.5, 10)}"
0 commit comments