Problem1238--set

1238: set

Time Limit: 2 Sec  Memory Limit: 128 MB
Submit: 36  Solved: 25
[Submit] [Status] [Web Board] [Creator:]

Description

PIPI want to divide the integers in [A, B] into some sets.
Initially,every integer is in its own set. If two integers i, j belongs to two sets si,sj, but i and j are both multiple of a prime p which is no less than P,you should union si, sj .
Calculate the number of sets in the end.

Input

3 integers , A, B, P, (1 ≤ AB ≤ 1012, BA + 106, 2 ≤ PB)

Output

1 interger, the number of sets in the end.

Sample Input

10 20 3

Sample Output

7

Source/Category