OFFSET
1,5
COMMENTS
The number of primes p <= n with p coprime to n. - Enrique Pérez Herrero, Jul 23 2011
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
From Reinhard Zumkeller, Apr 05 2004: (Start)
a(n) = Sum_{p prime and p<=n} (ceiling(n/p) - floor(n/p)).
EXAMPLE
MAPLE
A048865 := n -> nops(select(isprime, select(k -> igcd(n, k) = 1, [$1..n]))):
seq(A048865(n), n = 1..81); # Peter Luschny, Jul 23 2011
MATHEMATICA
p=Prime[Range[1000]]; q=Table[PrimePi[i], {i, 1, 1000}]; t=Table[c=0; Do[If[GCD[p[[j]], i]==1, c++ ], {j, 1, q[[i-1]]}]; c, {i, 2, 950}]
Table[Count[Select[Range@ n, CoprimeQ[#, n] &], p_ /; PrimeQ@ p], {n, 81}] (* Michael De Vlieger, Apr 27 2016 *)
Table[PrimePi[n] - PrimeNu[n], {n, 50}] (* G. C. Greubel, May 16 2017 *)
PROG
(PARI) A048865(n)=primepi(n)-omega(n)
(Haskell)
a048865 n = sum $ map a010051 [t | t <- [1..n], gcd n t == 1]
-- Reinhard Zumkeller, Sep 16 2011
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved