OFFSET
1,3
LINKS
FORMULA
EXAMPLE
For n = 8 = 2*2*2, none of the prime divisors are unitary, thus a(8) = 0.
For n = 20 = 2*2*5 = prime(1)^2 * prime(3), the prime divisor 2 is not unitary, but 5 (= prime(3)) is, thus a(20) = 3.
For n = 36 = 2*2*3*3, none of the prime divisors are unitary, thus a(36) = 0.
MATHEMATICA
Table[If[Length@ # == 0, 0, PrimePi@ First@ #] &@ Select[FactorInteger[n][[All, 1]], GCD[#, n/#] == 1 &], {n, 105}] (* Michael De Vlieger, Oct 30 2016 *)
PROG
(Scheme) (definec (A277697 n) (cond ((= 1 n) 0) ((= 1 (A067029 n)) (A055396 n)) (else (A277697 (A028234 n)))))
(Python)
from sympy import factorint, primepi, isprime, primefactors
def a049084(n): return primepi(n)*(1*isprime(n))
def a055396(n): return 0 if n==1 else a049084(min(primefactors(n)))
def a028234(n):
f = factorint(n)
return 1 if n==1 else n/(min(f)**f[min(f)])
def a067029(n):
f=factorint(n)
return 0 if n==1 else f[min(f)]
def a(n): return 0 if n==1 else a055396(n) if a067029(n)==1 else a(a028234(n)) # Indranil Ghosh, May 15 2017
(PARI) a(n) = {my(f = factor(n)); for(i = 1, #f~, if(f[i, 2] == 1, return(primepi(f[i, 1])))); 0; } \\ Amiram Eldar, Jul 28 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Oct 28 2016
STATUS
approved