OFFSET
1,2
COMMENTS
Number of power residues r (mod n) of prime powers p^m such that p | n and m >= 0.
Define S(p,n) to be the set of residues r (mod n) taken by the power range of prime divisor p, i.e., {p^m, m >= 1}. Examples: S(2,10) = {1, 2, 4, 8, 6}, while S(2,8) = {0, 1, 2, 4} and S(2,12) = {1, 2, 4, 8}; S(3,6) = {1, 3}, S(3,9) = {0, 1, 3}, S(3,12) = {1, 3, 9}, etc.
This sequence is card(union(S(p,n))) where S(p,n) is taken across prime factors p | n.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..5000
Michael De Vlieger, Log log scatterplot of a(n), n = 1..2310, showing a(n) for prime n in red, a(n) for proper prime power n in gold, a(n) such that n is squarefree and composite in green, and a(n) such that n is neither squarefree nor prime power in blue and magenta, where the latter color also signifies n is powerful but not a prime power.
FORMULA
a(1) = 1.
a(p) = 2 since S(p,p) = {0, 1}.
a(p^m) = m+1 since S(p,p^m) = {0} U {p^i, i < m}.
EXAMPLE
Table of n, a(n) for select values of n, showing the residues listed in row n of A381799:
n a(n) row n of A381799.
------------------------------------------------
1 1 {0}
2 2 {0,1}
4 3 {0,1,2}
6 4 {1,2,3,4}
8 4 {0,1,2,4}
10 6 {1,2,4,5,6,8}
12 6 {1,2,3,4,8,9}
14 5 {1,2,4,7,8}
15 7 {1,3,5,6,9,10,12}
18 9 {1,2,3,4,8,9,10,14,16}
20 7 {1,2,4,5,8,12,16}
21 8 {1,3,6,7,9,12,15,18}
22 12 {1,2,4,6,8,10,11,12,14,16,18,20}
24 7 {1,2,3,4,8,9,16}
26 14 {1,2,4,6,8,10,12,13,14,16,18,20,22,24}
28 7 {1,2,4,7,8,16,21}
30 11 {1,2,3,4,5,8,9,16,21,25,27}
33 8 {1,3,9,11,12,15,22,27}
34 10 {1,2,4,8,16,17,18,26,30,32}
35 11 {1,5,7,10,14,15,20,21,25,28,30}
36 11 {1,2,3,4,8,9,16,20,27,28,32}
a(1) = 1 since 1 is the empty product.
a(2) = 2 since S(2,2) = {0, 1}.
a(4) = 3 since S(2,4) = {1,2,0}.
a(6) = 4 since {1,2,3,4} is the union of S(2,6) = {1,2,4} and S(3,6) = {1,3}.
a(10) = 6 since {1,2,4,5,6,8} is the union of S(2,10) = {1,2,4,8,6} and S(5,10) = {1,5}.
a(12) = 6 since {1,2,3,4,8,9} is the union of S(2,12) = {1,2,4,8} and S(3,12) = {1,3,9}.
a(30) = 11 since {1,2,3,4,5,8,9,16,21,25,27} is the union of S(2,30) = {1,2,4,8,16}, S(3,30) = {1,3,9,27,21}, and S(5,30) = {1,5,25}, etc.
MATHEMATICA
{1}~Join~Table[CountDistinct@ Flatten@ Map[(p = #; NestWhileList[Mod[p*#, n] &, 1, UnsameQ, All]) &, FactorInteger[n][[All, 1]] ], {n, 2, 120}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Michael De Vlieger, Mar 07 2025
STATUS
approved
