Easy.

```
```

```
# Defining the function with two parameters
# number of primes between m and n.
# (Note: It still needs to calculate all primes
# up to m even though it won't be printed on the
# terminal.)
def prime(m, n)
# This holds the total number of primes in
# the range specified in the parameters.
number = 0
# This is the array to hold all the primes.
ary = []
# This loop from 1 to n runs until it reaches
# the n specified in the parameter.
for i in 1..n
# Unless it's divisible by 2
# (*psst*
```**even numbers**);
# this will exclude 2 as a prime
# but I'll put it back it after
# this block.
unless i % 2 0
# This count shows if the current
# number is divisible by a number
# other than 1 or itself.
# (This actually should be a boolean.)
count = 0
# In the prime array each element is
# taken out and put in j, then i is
# mod j to see if it's divisible by
# some prime number, there for making
# a composite number.
ary.each do |j|
if i % j 0
# That is unless the prime number
# is 1 or itself.
unless j i || j 1
count = 1
break
end # End of 'unless j i || j 1'.
end
end
# If no prime number is divisible by it
# push the prime into the prime array.
if count 0
ary.push(i)
# Unless the prime is not in the range
# the parameters specify, don't print it.
unless i <= m
puts i
# Add to total number of primes.
number += 1
end
end
end # End of 'unless i % 2 0'.
# This is to add in 2 from the
# exclusion before.
if i == 2
ary.push(i)
unless i <= m
puts i
number += 1
end
end
end # End of 'for i in 1..n'.
# Display total number of primes.
puts "number #{number}"
end
# Run the function using input from the terminal.
prime(ARGV[0].to_i, ARGV[1].to_i)

```
```

Save as `prime.rb`

run it and enjoy.