The answer is 8.
The easy way to see that is to observe that 15 is 3  5.
That's a composite number that can be broken down into two primes.
Then if we look at the numbers from 1 to 14--
these are all the positive integers less than n--
we want to figure out how many of these are relatively prime.
The multiples of 3 are not. You can cross all those out.
true for the multiples of 5 as well.
The multiples of 5 are not.
That leaves us with eight numbers.
This works in general. If we know that n is the product of two primes.
Then we could compute φ(n).
It's the number of integers less than n,
which is also pq - 1. That would be all the integers.
Then we subtract out all the multiples of p that are less than n.
Since n is pq, there are q - 1 of those.
Then we want to subtract all the multiples of q less than n,
which is again pq, so there are p - 1 of those.
If we do the algebra, we get pq - (p + q) +1,
which we could also write as (p -1)(q - 1).
Since p and q are prime--and this property depended on q being prime.
Otherwise, some of these multiples might have collided.
Since they are prime, we know they didn't.
That means that we know that φ(n) is equal φ(p)φ(q).
This is going to turn out very useful for RSA.
The reason for that is if we know the factors of n,
we have an easy way to compute the value of φ(n).
But if we don't know the values of p and q,
it appears to be hard to compute the value of φ(pq).
That's the crux of what the security of RSA relies on,
and we'll talk more about that later.
For now we're still focused on correctness.
