A207193 Auxiliary function for computing the Carmichael lambda function (A002322).
1, 1, 2, 2, 4, 6, 2, 6, 10, 12, 4, 16, 18, 22, 20, 18, 28, 30, 8, 36, 40, 42, 46, 42, 52, 58, 60, 16, 66, 70, 72, 78, 54, 82, 88, 96, 100, 102, 106, 108, 112, 110, 100, 126, 32, 130, 136, 138, 148, 150, 156, 162, 166, 156, 172, 178, 180, 190, 192, 196, 198
Offset: 1
Keywords
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Programs
-
Haskell
a207193 1 = 1 a207193 n | p == 2 && e > 2 = 2 ^ (e - 2) | otherwise = (p - 1) * p ^ (e - 1) where p = a025473 n; e = a025474 n
-
Mathematica
f[p_, e_] := If[p == 2 && e > 2, 2^(e-2), (p-1)*p^(e-1)]; s[n_] := If[n == 1, 1, If[PrimePowerQ[n], f @@ (FactorInteger[n][[1]]), Nothing]]; Array[s, 200] (* Amiram Eldar, Apr 05 2025 *)
Formula
a(n) = f(A000961(n)), where f(1) = 1, and f(p^e) = 2^(e-2) if p = 2 and e > 2, and f(p^e) = (p-1)*p^(e-1) otherwise.