fork download
  1. require 'prime'
  2. class Integer
  3. def primorial
  4. Prime.each(self).inject(1, :*)
  5. end
  6. end
  7. p [0, 1, 3, 4, 5, 21].map {|i| [i, i.primorial]}
  8.  
Success #stdin #stdout 0s 28344KB
stdin
Standard input is empty
stdout
[[0, 1], [1, 1], [3, 6], [4, 6], [5, 30], [21, 9699690]]