Populate an array in ruby with 7n +1 -
how make following array programatically in ruby (1.9).
it follows pattern 7n + 1 , i'd contain 24 numbers.
arr = ["8","15","22","29","36","43","50","57","64","71" ]
use collect
, apply to_s
on result:
(1..24).collect{|n| (n*7 + 1).to_s}
edit: sorry forgot convert numbers strings. code edited now.