A126080 a(n) = number of positive integers < n that are coprime to exactly one prime divisor of n.
0, 1, 2, 2, 4, 3, 6, 4, 6, 5, 10, 6, 12, 7, 6, 8, 16, 9, 18, 10, 8, 11, 22, 12, 20, 13, 18, 14, 28, 7, 30, 16, 12, 17, 10, 18, 36, 19, 14, 20, 40, 9, 42, 22, 18, 23, 46, 24, 42, 25, 18, 26, 52, 27, 14, 28, 20, 29, 58, 14, 60, 31, 24, 32, 16, 13, 66, 34, 24, 11, 70, 36, 72, 37, 30, 38
Offset: 1
Keywords
Examples
Concerning a(12): 1,5,7,11 are coprime to each prime dividing 12; so these integers are not counted. 6 is coprime to 0 primes dividing 12; so this integer is not counted. But the 6 integers 2,3,4,8,9,10 are each coprime to exactly one prime dividing 12; so a(12) = 6. Concerning a(30): Only the 7 integers 6,10,12,15,18,20,24 are each coprime to exactly one prime dividing 30. So a(30) = 7.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
Programs
-
Maple
A126080 := proc(n) local divs,pdivs,a,i,pcnt,p; divs := numtheory[divisors](n); pdivs := []; for i from 1 to nops(divs) do if isprime(op(i,divs)) then pdivs := [op(pdivs),op(i,divs)]; fi; od; a := 0; for i from 1 to n-1 do pcnt := 0; for p from 1 to nops(pdivs) do if gcd(i,op(p,pdivs)) = 1 then pcnt := pcnt+1; fi; od; if pcnt = 1 then a := a+1; fi; od; RETURN(a); end: for n from 1 to 90 do printf("%d, ",A126080(n)); od; # R. J. Mathar, Mar 14 2007
-
Mathematica
Table[Count[Range[n - 1], k_ /; Total@ Boole@ Map[CoprimeQ[k, #] &, #] == 1] &[FactorInteger[n][[All, 1]]], {n, 76}] (* Michael De Vlieger, Sep 19 2017 *)
-
PARI
a(n) = my(f=factor(n)); #select(x->(x==1), vector(n-1, j, sum(k=1, #f~, gcd(j, f[k,1]) == 1))); \\ Michel Marcus, Oct 25 2017
Formula
a(p) = p - 1.
Extensions
More terms from R. J. Mathar, Mar 14 2007