Problem:
How Many Divisors?

Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b.

Input

Three integers a, b and c are given in a line separated by a single space.

Output

Print the number of divisors in a line.

Constraints

1 ≤ a, b, c ≤ 10000

a ≤ b

Sample Input 1

5 14 80

Sample Output 1

3

Solution in Ruby (judge verdict: Accepted)

require 'prime'

class Integer
  def divisor_list
    return [] if self <= 0
    return [1] if self == 1

    prime_division.map{|e| [*(0..e.last)].map{|v| e.first ** v }}.inject{|res, e| res.map{|t| e.map{|v| t * v}}.flatten}.sort
  end
end

class Array
  def upper_bound(val)
    a = 0
    b = size

    while a < b
      c = (( a + b ) / 2 ).to_i

      if val < at(c)
        b = c
      else
        a = c + 1
      end
    end

    b
  end

  def lower_bound(val)
    a = 0
    b = size

    while a < b
      c = (( a + b ) / 2 ).to_i

      if val <= at(c)
        b = c
      else
        a = c + 1
      end
    end

    b
  end
end

class Solver
  def initialize
    a, b, c = gets.chomp.split(' ').map(&:to_i)

    divisor_list = c.divisor_list

    n = divisor_list.lower_bound(a)
    m = divisor_list.upper_bound(b)

    puts m - n
  end
end

Solver.new