# How many numbers exists that are smaller than $p$ and prime with $p$?

I have a homework to hand in and they asked this question. I don't know if I'm supposed to count 1 as a prime to that number or not.

In my case $p=3947$, so I count 3945 numbers fitting that criteria since $p$ is prime.

Is this correct ?

Thanks.

-
I would definitely count 1, since the normal definition if "prime to ..." is that the greatest common factor should be 1. – Old John Nov 15 '12 at 15:16
There are not 3945 primes lower than $3947$. – Arthur Nov 15 '12 at 15:21
I understand that he is not counting primes below $p$, but rather numbers below $p$ which are "prime to $p$", i.e. relatively prime to $p$. – Old John Nov 15 '12 at 15:30
@JonasKibelbek : I edited the question to be clearer. You're right that it's a different question. – BrainOverfl0w Nov 15 '12 at 15:35
$p=3947$ is prime. Therefore the answer is $\phi(p)=p-1=3946$. – PAD Nov 15 '12 at 15:52

## 1 Answer

The correct terminology is 'co-prime' with p. And there's a known formula for it. Euler's totient. look at http://en.wikipedia.org/wiki/Euler_totient_function.

-
Thanks, in short $3947$ is the answer I was looking for. Euler's totient function clarified my confusion. – BrainOverfl0w Nov 15 '12 at 16:07
If you take the average of your 2 answers then you are correct! – PAD Nov 15 '12 at 16:25