OFFSET
1,5
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^16, showing prime n in red, proper prime power n in gold, squarefree composite n in green, and n that is neither squarefree nor prime power in blue and magenta, with magenta also representing powerful n that is not a prime power.
FORMULA
EXAMPLE
a(n) = 0 for n = 1..2, since there do not exist any residues mod n that do not represent a power of n.
n a(n) [0..n-1] \ row n of A381801.
------------------------------------------------
6 1 {5}
10 3 {3,7,9}
12 4 {5,7,10,11}
14 8 {3,5,6,9,10,11,12,13}
15 7 {2,4,7,8,11,13,14}
18 6 {5,7,11,13,15,17}
20 11 {3,6,7,9,11,13,14,15,17,18,19}
21 12 {2,4,5,8,10,11,13,14,16,17,19,20}
22 9 {3,5,7,9,13,15,17,19,21}
24 13 {5,7,10,11,13,14,15,17,19,20,21,22,23}
26 11 {3,5,7,9,11,15,17,19,21,23,25}
28 19 {3,5,6,9,10,11,12,13,15,17,18,19,20,22,23,24,25,26,27}
30 11 {7,11,13,14,17,19,22,23,26,28,29}
MATHEMATICA
f[x_] := Block[{c, ff, m, r, p, s, w}, c[_] := True;
ff = FactorInteger[x][[All, 1]]; w = Length[ff]; s = {1};
Do[Set[p[i], ff[[i]]], {i, w}];
Do[Set[s, Union@ Flatten@ Join[s, #[[-1, 1]] ] ] &@ Reap@
Do[m = s[[j]];
While[Sow@ Set[r, Mod[m*p[i], x]];
c[r], c[r] = False;
m *= p[i]], {j, Length[s]}], {i, w}]; s];
{0}~Join~Table[n - Length@ f[n], {n, 2, 120}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Michael De Vlieger, Mar 14 2025
STATUS
approved
