A277707 a(n) = index of the least prime divisor of n which has an odd exponent, or 0 if n is a perfect square.
0, 1, 2, 0, 3, 1, 4, 1, 0, 1, 5, 2, 6, 1, 2, 0, 7, 1, 8, 3, 2, 1, 9, 1, 0, 1, 2, 4, 10, 1, 11, 1, 2, 1, 3, 0, 12, 1, 2, 1, 13, 1, 14, 5, 3, 1, 15, 2, 0, 1, 2, 6, 16, 1, 3, 1, 2, 1, 17, 2, 18, 1, 4, 0, 3, 1, 19, 7, 2, 1, 20, 1, 21, 1, 2, 8, 4, 1, 22, 3, 0, 1, 23, 2, 3, 1, 2, 1, 24, 1, 4, 9, 2, 1, 3, 1, 25, 1, 5, 0, 26, 1, 27, 1, 2
Offset: 1
Keywords
Examples
For n = 8 = 2*2*2 = prime(1)^3, the exponent of the least (and the only) prime factor 2 is 3, an odd number, thus a(8) = 1 as 2 = prime(1).
Links
Crossrefs
Programs
-
PARI
a(n) = my(f = factor(core(n))); if (!#f~, 0, primepi(vecmin(f[,1]))); \\ Michel Marcus, Oct 30 2016
-
Python
from sympy import primepi, isprime, primefactors from sympy.ntheory.factor_ import core def a049084(n): return primepi(n)*(1*isprime(n)) def a055396(n): return 0 if n==1 else a049084(min(primefactors(n))) def a(n): return a055396(core(n)) # Indranil Ghosh, May 17 2017