OFFSET
1,9
COMMENTS
LINKS
Jianing Song, Table of n, a(n) for n = 1..9396 (rows 1..1000)
EXAMPLE
{1}
{1}
{1, 1}
{1, 1}
{1, 1, 2}
{1, 1}
{1, 1, 2, 2}
{1, 3}
{1, 1, 2, 2}
{1, 1, 2}
{1, 1, 4, 4}
{1, 3}
{1, 1, 2, 2, 2, 4}
{1, 1, 2, 2}
{1, 3, 4}
{1, 3, 4}
{1, 1, 2, 4, 8}
{1, 1, 2, 2}
{1, 1, 2, 2, 6, 6}
{1, 3, 4}
{1, 3, 2, 6}
{1, 1, 4, 4}
{1, 1, 10, 10}
{1, 7},
{1, 1, 2, 4, 4, 8}
The row for n=21 reads: 1,3,2,6 because the multiplicative group mod 21, (Z/21*Z,*) is isomorphic to C_6 X C_2. The exponent of this group is 6. This group contains one element of order 1, three elements of order 2, two elements of order 3, and six elements of order 6.
MATHEMATICA
f[{p_, e_}] := {FactorInteger[p - 1][[All, 1]]^
FactorInteger[p - 1][[All, 2]],
FactorInteger[p^(e - 1)][[All, 1]]^
FactorInteger[p^(e - 1)][[All, 2]]};
fun[lst_] :=
Module[{int, num, res},
int = Sort /@ GatherBy[Join @@ (FactorInteger /@ lst), First];
num = Times @@ Power @@@ (Last@# & /@ int);
res = Flatten[Map[Power @@ # &, Most /@ int, {2}]];
{num, res}]
rec[lt_] :=
First@NestWhile[{Append[#[[1]], fun[#[[2]]][[1]]],
fun[#[[2]]][[2]]} &, {{}, lt}, Length[#[[2]]] > 0 &];
t[list_] :=
Table[Count[Map[PermutationOrder, GroupElements[AbelianGroup[list]]],
d], {d, Divisors[First[list]]}];
Map[t, Table[
If[! IntegerQ[n/8],
DeleteCases[rec[Flatten[Map[f, FactorInteger[n]]]], 0|1],
DeleteCases[
rec[Join[{2, 2^(FactorInteger[n][[1, 2]] - 2)},
Flatten[Map[f, Drop[FactorInteger[n], 1]]]]], 1]], {n, 1, 25}] /. {} -> {1}] (* Edited by Jianing Song, May 29 2026 to include n = 1 *)
PROG
(PARI) power_solution(invariant_factors, k) = vecprod(apply(x->gcd(x, k), invariant_factors)); \\ number of solutions to x^k = 1 in C_{k_1} X ... C_{k_r}
count_order(invariant_factors, k) = sumdiv(k, d, moebius(k/d)*power_solution(invariant_factors, d)); \\ number of elements of order k
row(n) = my(invariant_factors=znstar(n)[2], k=lcm(invariant_factors)); apply(x->count_order(invariant_factors, x), divisors(k)); \\ Jianing Song, May 29 2026
CROSSREFS
KEYWORD
nonn,tabf,changed
AUTHOR
Geoffrey Critzer, Dec 01 2015
STATUS
approved
