login
a(n) = p-1 if n=p, p if n=p^e and e<>1, 1 otherwise; p a prime.
3

%I #22 Aug 25 2015 17:23:51

%S 1,1,2,2,4,1,6,2,3,1,10,1,12,1,1,2,16,1,18,1,1,1,22,1,5,1,3,1,28,1,30,

%T 2,1,1,1,1,36,1,1,1,40,1,42,1,1,1,46,1,7,1,1,1,52,1,1,1,1,1,58,1,60,1,

%U 1,2,1,1,66,1,1,1,70,1,72,1,1,1,1,1,78,1,3,1,82,1,1,1,1,1,88,1,1,1,1,1

%N a(n) = p-1 if n=p, p if n=p^e and e<>1, 1 otherwise; p a prime.

%C Product_{d divides n} a(d) = phi(n).

%H Reinhard Zumkeller, <a href="/A072211/b072211.txt">Table of n, a(n) for n = 1..1000</a>

%F a(n) = Product_{d divides n} phi(n/d)^mu(d). - _Vladeta Jovovic_, Mar 08 2004

%F a(n) = A217863(n)/A217863(n-1) for n > 1. - _Eric Desbiaux_, Nov 23 2012; corrected by _Thomas Ordowski_, Aug 25 2015

%F D.g.f.: zeta(s) + Sum_{p prime} (p-2+p^(-s))/(p^s-1), - _Robert Israel_, Aug 25 2015

%p f:= proc(n)

%p local P;

%p P:= numtheory:-factorset(n);

%p if nops(P) > 1 then 1

%p elif n = P[1] then P[1]-1

%p else P[1]

%p fi

%p end proc:

%p 1, seq(f(n),n=2..100); # _Robert Israel_, Aug 25 2015

%t Table[Which[PrimeQ@ n, n - 1, ! PrimeQ@ n && PrimePowerQ@ n,

%t First @@ FactorInteger@ n, True, 1], {n, 88}] (* _Michael De Vlieger_, Aug 25 2015 *)

%o (Haskell)

%o a072211 n = a072211_list !! (n-1)

%o a072211_list = 1 : zipWith div (tail a217863_list) a217863_list

%o -- _Reinhard Zumkeller_, Nov 24 2012

%o (PARI) a(n) = pp = isprimepower(n, &p); if (pp==1, n-1, if (pp, p, 1)); \\ _Michel Marcus_, Aug 25 2015

%Y Cf. A000010.

%K nonn

%O 1,3

%A _Vladeta Jovovic_, Jul 03 2002