Displaying 1-10 of 48 results found.
Values taken by phi(phi(m)) ( A010554).
+20
6
1, 2, 4, 6, 8, 10, 12, 16, 18, 20, 22, 24, 28, 32, 36, 40, 44, 48, 52, 54, 56, 60, 64, 72, 80, 82, 84, 88, 92, 96, 100, 104, 108, 112, 120, 128, 130, 132, 144, 156, 160, 162, 164, 168, 172, 176, 178, 180, 184, 190, 192, 200, 204, 208, 212, 216, 220, 224, 232, 238, 240, 250, 252, 256, 260, 264, 272, 276, 280, 288, 292, 300, 312, 320, 324, 328, 336, 344, 348, 352, 356, 358, 360, 368, 380, 384, 396, 400
COMMENTS
Numbers k such that A378506(k) > 0.
MATHEMATICA
q[k_] := AnyTrue[PhiInverse[k], PhiMultiplicity[#] > 0 &]; Select[Range[1000], q] (* using David M. Bressoud's CNT.m *)
PROG
(PARI) is(k) = {my(v = invphi(k)); for(i = 1, #v, if(istotient(v[i]), return(1))); 0; } \\ using Max Alekseyev's invphi.gp
Number of primitive roots modulo n.
+10
32
1, 1, 1, 1, 2, 1, 2, 0, 2, 2, 4, 0, 4, 2, 0, 0, 8, 2, 6, 0, 0, 4, 10, 0, 8, 4, 6, 0, 12, 0, 8, 0, 0, 8, 0, 0, 12, 6, 0, 0, 16, 0, 12, 0, 0, 10, 22, 0, 12, 8, 0, 0, 24, 6, 0, 0, 0, 12, 28, 0, 16, 8, 0, 0, 0, 0, 20, 0, 0, 0, 24, 0, 24, 12, 0, 0, 0, 0, 24, 0, 18, 16, 40, 0, 0, 12, 0, 0, 40, 0, 0
FORMULA
a(n) is equal to A010554(n) unless n is a term of A033949, in which case a(n)=0.
EXAMPLE
a(11)=4 since there are four primitive roots (mod 11): 2, 6, 7, and 8. - Michael B. Porter, Oct 22 2025
MAPLE
local a, eulphi, m;
if n = 1 then
return 1;
end if;
eulphi := numtheory[phi](n) ;
a := 0 ;
for m from 0 to n-1 do
if numtheory[order](m, n) = eulphi then
a := a + 1 ;
end if;
end do:
a;
MATHEMATICA
Prepend[ Table[ If[ IntegerQ[ PrimitiveRoot[n]] , EulerPhi[ EulerPhi[n]], 0], {n, 2, 91}], 1] (* Jean-François Alcover, Sep 13 2011 *)
PROG
(PARI) for(i=1, 100, p=0; for(q=1, i, if(gcd(q, i)==1 && znorder(Mod(q, i)) == eulerphi(i), p++)); print1(p, ", ")) /* V. Raman, Nov 22 2012 */
(PARI) a(n) = my(s=znstar(n)); if(#(s.cyc)>1, 0, eulerphi(s.no)) \\ Jeppe Stig Nielsen, Oct 18 2019
(Perl) use ntheory ":all"; my @A = map { !defined znprimroot($_) ? 0 : euler_phi(euler_phi($_)); } 0..10000; say "$_ $A[$_]" for 1..$#A; # Dana Jacobsen, Apr 28 2017
CROSSREFS
Cf. A001918, A010554, A033949, A046145, A046146, A008330, A002233, A071894, A219027, A211487, A111725.
Smallest primitive root modulo n, or 0 if no root exists.
+10
25
0, 0, 1, 2, 3, 2, 5, 3, 0, 2, 3, 2, 0, 2, 3, 0, 0, 3, 5, 2, 0, 0, 7, 5, 0, 2, 7, 2, 0, 2, 0, 3, 0, 0, 3, 0, 0, 2, 3, 0, 0, 6, 0, 3, 0, 0, 5, 5, 0, 3, 3, 0, 0, 2, 5, 0, 0, 0, 3, 2, 0, 2, 3, 0, 0, 0, 0, 2, 0, 0, 0, 7, 0, 5, 5, 0, 0, 0, 0, 3, 0, 2, 7, 2, 0, 0, 3, 0, 0, 3, 0, 0, 0, 0, 5, 0, 0, 5, 3, 0, 0
COMMENTS
The value 0 at index 0 says 0 has no primitive roots, but the 0 at index 1 says 1 has a primitive root of 0, the only real 0 in the sequence.
a(n) is nonzero if and only if n is 2, 4, or of the form p^k, or 2*p^k where p is an odd prime and k>0. - Tom Edgar, Jun 02 2014
MAPLE
if n <=1 then
0;
else
pr := numtheory[primroot](n) ;
if pr = FAIL then
return 0 ;
else
return pr ;
end if;
end if;
end proc:
MATHEMATICA
smallestPrimitiveRoot[n_ /; n <= 1] = 0; smallestPrimitiveRoot[n_] := Block[{pr = PrimitiveRoot[n], g}, If[! NumericQ[pr], g = 0, g = 1; While[g <= pr, If[ CoprimeQ[g, n] && MultiplicativeOrder[g, n] == EulerPhi[n], Break[]]; g++]]; g]; smallestPrimitiveRoot /@ Range[0, 100] (* Jean-François Alcover, Feb 15 2012 *)
(* Alternative: *)
f[n_] := Block[{pr = PrimitiveRootList[n]}, If[pr == {}, 0, pr[[1]]]]; Array[f, 105, 0] (* v10.0 Robert G. Wilson v, Nov 04 2014 *)
PROG
(PARI) { A046145(n) = for(q=1, n-1, if(gcd(q, n)==1 && znorder(Mod(q, n))==eulerphi(n), return(q); )); 0; } /* V. Raman, Nov 22 2012, edited by Max Alekseyev, Apr 20 2017 */
(Perl) use ntheory ":all"; say "$_ ", znprimroot($_) || 0 for 0..100; # Dana Jacobsen, Mar 16 2017
CROSSREFS
Cf. A001918, A046144, A046146, A002233, A071894, A219027, A008330, A010554, A111076, A285512, A285513, A285514.
Largest primitive root modulo n, or 0 if no root exists.
+10
13
0, 0, 1, 2, 3, 3, 5, 5, 0, 5, 7, 8, 0, 11, 5, 0, 0, 14, 11, 15, 0, 0, 19, 21, 0, 23, 19, 23, 0, 27, 0, 24, 0, 0, 31, 0, 0, 35, 33, 0, 0, 35, 0, 34, 0, 0, 43, 45, 0, 47, 47, 0, 0, 51, 47, 0, 0, 0, 55, 56, 0, 59, 55, 0, 0, 0, 0, 63, 0, 0, 0, 69, 0, 68, 69, 0, 0, 0, 0, 77, 0, 77, 75, 80, 0, 0
COMMENTS
The value 0 at index 0 says 0 has no primitive roots, but the 0 at index 1 says 1 has a primitive root of 0, the only real 0 in the sequence. - Initial terms corrected by Harry J. Smith, Jan 27 2005
a(n) is nonzero if and only if n is 2, 4, or of the form p^k, or 2*p^k where p is an odd prime and k>0. - Tom Edgar, Jun 02 2014
MATHEMATICA
f[n_] := Block[{pr = PrimitiveRootList[n]}, If[pr == {}, 0, pr[[-1]]]]; Array[f, 86, 0] (* Robert G. Wilson v, Nov 03 2014 *)
PROG
(PARI) for(i=0, 100, p=0; for(q=1, i-1, if(gcd(q, i)==1&&znorder(Mod(q, i))==eulerphi(i), p=q)); print1(p", ")) /* V. Raman, Nov 22 2012 */
Number of residues modulo n of the maximum order.
+10
13
1, 1, 1, 1, 2, 1, 2, 3, 2, 2, 4, 3, 4, 2, 4, 4, 8, 2, 6, 4, 6, 4, 10, 7, 8, 4, 6, 6, 12, 4, 8, 8, 12, 8, 8, 6, 12, 6, 8, 8, 16, 6, 12, 12, 8, 10, 22, 8, 12, 8, 16, 8, 24, 6, 16, 14, 18, 12, 28, 8, 16, 8, 24, 16, 24, 12, 20, 16, 30, 8, 24, 14, 24, 12, 16, 18, 24, 8, 24, 24, 18, 16, 40, 14, 32, 12
COMMENTS
The maximum order modulo n is given by A002322(n).
a(n) is the number of primitive lambda-roots of n. - Michel Marcus, Mar 17 2016
A primitive lambda-root is an element of maximal order modulo n. - Joerg Arndt, Mar 19 2016
a(n) is odd if and only if n is a divisor of 24, i.e., n is in A018253. - Jianing Song, Apr 27 2019
FORMULA
Decompose (Z/nZ)* as a product of cyclic groups C_{k_1} x C_{k_2} x ... x C_{k_m}, where k_i divides k_j for i < j, then a(n) = Sum_{d divides psi(n)} (mu(psi(n)/d)*Product{i=1..m} gcd(d, k_i)). This is an immediate corollary from the fact that the number of elements in (Z/nZ)* such that x^d == 1 (mod n) is Product{i=1..m} gcd(d, k_i). Here (Z/nZ)* is the multiplicative group of integers modulo n, psi(n) = A002322(n) and mu(n) = A008683(n). - Jianing Song, Apr 27 2019
Decompose (Z/nZ)* as a product of cyclic groups C_{k_1} x C_{k_2} x ... x C_{k_m}, where k_i divides k_j for i < j, then a(n) = phi(n) * Product_{p prime dividing phi(n)} (1 - 1/p^r(p)), where r(p) is the number of j such that v(k_j,p) = v(k_m,p), v(s,p) is the p-adic valuation of s.
Proof: let G = (Z/nZ)*, G_p be the Sylow p-subgroup of G, then G = Product_{p prime dividing phi(n)} G_p: every element x can be uniquely written as Product_{p prime dividing phi(n)} x_p for x_p in G_p. Let ord(x) be the order of x. Since ord(x_p, x_p') = 1 for distinct p and p', we have ord(x) = Product_{p prime dividing phi(n)} ord(x_p), hence x is of maximal order if and only if each x_p is of maximal order in G_p.
Each G_p is isomorphic to C_{p^(e_1)} x C_{p^(e_2)} x ... x C_{p^(e_m)} for e_1 <= e_2 <= ... <= e_m, e_m > 0. Write x_p = (x_{p,1}, x_{p,2}, ..., x_{p,m}). Suppose that e_m = e_{m-1} = ... = e_{m-r+1} > e_{m-r}, then x_p is of maximal order in G_p if and only of x_{p,j} is of order p^(e_m) for some m-r+1 <= j <= m, so the number of such x_p is p^(e_1) * p^(e_2) * ... * p^(e_{m-r}) * (p^(r*e_m) - p^(r*((e_m)-1))) = |G_p| * (1 - 1/p^r).
An example: n = 15903, then (Z/nZ)* = C_6 x C_18 x C_90. We can see that r(2) = 3, r(3) = 2 and r(5) = 1, so a(15903) = phi(15903) * (1 - 1/2^3) * (1 - 1/3^2) * (1 - 1/5^1) = 6048.
It should be clear that a(n) = phi(phi(n)) if and only if r(p) = 1 for every prime p dividing phi(n), or v(k_{m-1},p) < v(k_m,p) for every prime p dividing phi(n). Otherwise, a(n) > phi(phi(n)). (End)
MAPLE
LiDelta := proc(q, n)
local a, p, e, lam, v ;
a := 0 ;
lam := numtheory[lambda](n) ;
for p in numtheory[factorset](n) do
e := padic[ordp](n, p) ;
if p =2 and e= 3 and q =2 and padic[ordp](lam, q) = 1 then
elif isprime(q) then
v := padic[ordp](lam, q) ;
if modp( numtheory[lambda](p^e), q^v) = 0 then
a := a+1 ;
end if;
end if:
end do:
a ;
end proc:
local a, q ;
a := 1;
for q in numtheory[factorset](numtheory[lambda](n)) do
a := a*(1-1/q^LiDelta(q, n)) ;
end do:
a*numtheory[phi](n) ;
end proc:
MATHEMATICA
f[list_]:=Count[list, Max[list]]; Map[f, Table[Table[MultiplicativeOrder[k, n], {k, Select[Range[n], GCD[#, n]==1&]}], {n, 1, 100}]] (* Geoffrey Critzer, Jan 26 2013 *)
PROG
(PARI) { a(n) = my(r, c, r1); r=1; c=0; for(k=0, n-1, if(gcd(k, n)!=1, next); r1=znorder(Mod(k, n)); if(r1==r, c++); if(r1>r, r=r1; c=1) ); c; }
(PARI) { A111725(n) = if(n<3, return(1)); my(k, p); k=znstar(n)[2]; p=factor(k[1])[, 1]; eulerphi(n) * prod(i=1, #p, (1-1/p[i]^vecsum(apply(x->valuation(k[1]\x, p[i])==0, k))) ); } \\ Max Alekseyev, Oct 23 2021
a(n) = Euler phi function applied 5 times to n.
+10
8
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 4, 1, 4, 1, 2, 2, 4, 1, 2, 2, 2, 2, 2, 2, 4, 1, 2, 2, 4, 2, 4, 2, 2
EXAMPLE
For n = 163, the successive iterates applying Euler totient function are as follows: 163, 162, 54, 18, 6, 2, 1. The 6th term is 2, when Phi was applied 5 times. So a(163)=2, already a power of 2.
For n = 487, the successive iterates are 486, 162, 54, 18, 6, 2, 1. On the fifth iteration we reach 6, thus a(487) = 6. This is also the first term of A049107 that is not a power of 2. - Antti Karttunen, Aug 22 2017
MATHEMATICA
a[n_]=Nest[ EulerPhi, n, 5 ]; Array[a, 105]
(* Alternative: *)
Sum of iterates when phi, A000010, is iterated until fixed point 1.
+10
8
1, 3, 6, 7, 12, 9, 16, 15, 18, 17, 28, 19, 32, 23, 30, 31, 48, 27, 46, 35, 40, 39, 62, 39, 60, 45, 54, 47, 76, 45, 76, 63, 68, 65, 74, 55, 92, 65, 78, 71, 112, 61, 104, 79, 84, 85, 132, 79, 110, 85, 114, 91, 144, 81, 126, 95, 112, 105, 164, 91, 152, 107, 118, 127, 144, 101
COMMENTS
For n = 2^w, the sum is 2^(w+1) - 1.
EXAMPLE
If phi is applied repeatedly to n = 91, the iterates {91, 72, 24, 8, 4, 2, 1} are obtained. Their sum is a(91) = 91 + 72 + 24 + 8 + 4 + 2 + 1 = 202.
MATHEMATICA
f[n_] := Plus @@ Drop[ FixedPointList[ EulerPhi, n], -1]; Table[ f[n], {n, 66}] (* Robert G. Wilson v, Dec 16 2004 *)
PROG
(Haskell)
a053478 = (+ 1) . sum . takeWhile (/= 1) . iterate a000010
a(n) = Euler phi function applied thrice to n.
+10
7
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 4, 1, 2, 2, 2, 2, 4, 2, 4, 2, 2, 2, 4, 2, 4, 4, 4, 4, 4, 2, 4, 2, 4, 4, 8, 2, 4, 4, 4, 4, 10, 4, 4, 4, 8, 4, 8, 2, 8, 4, 4, 4, 12, 4, 8, 4, 4, 8, 8, 4, 8, 8, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 8, 6, 8, 16, 4, 16, 4, 8, 8, 16, 4, 8, 8, 8, 10, 8, 8, 16, 4, 8, 8, 16
EXAMPLE
n=163: the successive iterates of Euler totient function are 163,162,54,18,6,2,1. The 4th term is 18, when Phi was applied 3 times. So a(163)=18.
MATHEMATICA
a[n_]=Nest[ EulerPhi, n, 3 ]; Array[a, 101]
a(n) = Euler phi function applied 4 times to n.
+10
7
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 4, 1, 2, 2, 2, 2, 4, 2, 2, 2, 4, 2, 4, 1, 4, 2, 2, 2, 4, 2, 4, 2, 2, 4, 4, 2, 4, 4, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 4, 2, 4, 8, 2, 8, 2, 4, 4, 8, 2, 4, 4, 4, 4, 4, 4, 8, 2, 4, 4, 8, 4, 8, 4, 4
EXAMPLE
n=163, the successive iterates applying Euler totient function are as follows: 163,162,54,18,6,2,1. The 5th term is 6, when Phi was applied 4 times. So a(163)=6.
MAPLE
with(numtheory): seq(phi(phi(phi(phi(n)))), n=1..130); # Emeric Deutsch, May 14 2006
MATHEMATICA
a[n_]=Nest[ EulerPhi, n, 4 ]; Array[a, 105]
Longest eventual period of a^(2^k) mod n for all a.
+10
6
1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 4, 1, 2, 2, 1, 1, 1, 2, 6, 1, 2, 4, 10, 1, 4, 2, 6, 2, 3, 1, 4, 1, 4, 1, 2, 2, 6, 6, 2, 1, 4, 2, 6, 4, 2, 10, 11, 1, 6, 4, 1, 2, 12, 6, 4, 2, 6, 3, 28, 1, 4, 4, 2, 1, 2, 4, 10, 1, 10, 2, 12, 2, 6, 6, 4, 6, 4, 2, 12, 1, 18, 4, 20, 2, 1, 6
COMMENTS
a(n) is a divisor of phi(phi(n)) ( A010554).
EXAMPLE
In other words, eventual period of {0..n-1} under the map x -> x^2 mod n.
For example, with n=10 the said map acts as follows. Read down the columns: the column headed 2 for example means that (repeatedly squaring mod 10), 2 goes to 4 goes to 16 = 6 (mod 10) goes to 36 = 6 mod 10 --- and has reached a fixed point.
0 1 2 3 4 5 6 7 8 9
0 1 4 9 6 5 6 9 4 1
0 1 6 1 6 5 6 1 6 1
0 1 6 1 6 5 6 1 6 1
and thus every number reaches a fixed point. This means the eventual common period is 1, hence a(10)=1.
MATHEMATICA
a[n_] := With[{lambda = CarmichaelLambda[n]}, MultiplicativeOrder[2, lambda / (2^IntegerExponent[lambda, 2])]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 28 2016 *)
PROG
(PARI) rpsi(n) = lcm(znstar(n)[2]); \\ A002322
pb(n) = znorder(Mod(2, n/2^valuation(n, 2))); \\ A007733
CROSSREFS
First differs from A256607 at n=43.
LCM of entries in row n of A279185.
Search completed in 0.002 seconds
|