OFFSET
1,3
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
FORMULA
a(p) = p - 1.
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Mar 02 2007
EXTENSIONS
More terms from R. J. Mathar, Mar 14 2007
STATUS
approved