OFFSET
1,2
COMMENTS
Question raised by David W. Wilson, equivalent formulae given independently by Don Reble and Robert Israel, cf. link to the SeqFan list.
"Fixed" means that f(S) = S, for the subset S and f = x -> x^2. The largest stable or "invariant" subset would be Z/nZ itself.
LINKS
David W. Wilson, Table of n, a(n) for n = 1..10000
Don Reble, in reply to D. Wilson, Mapping problem, SeqFan list, Nov. 2016. (Click "Next" twice for R. Israel's reply.)
FORMULA
EXAMPLE
a(25) = 6 is the cardinal of S = {0, 1, 6, 11, 16, 21}, the largest set of residues modulo 25 fixed by the mapping n -> n^2. - David W. Wilson, Nov 08 2016
MAPLE
f:= proc(n) local F; F:= ifactors(n)[2]; convert(map(proc(t) local p; p:=numtheory:-phi(t[1]^t[2]); 1+p/2^padic:-ordp(p, 2) end proc, F), `*`) end proc: # Robert Israel, Nov 09 2016
MATHEMATICA
oddpart[n_] := n/2^IntegerExponent[n, 2];
a[n_] := a[n] = Module[{p, e}, If[n == 1, 1, Product[{p, e} = pe; oddpart[ EulerPhi[p^e]] + 1, {pe, FactorInteger[n]}]]];
Array[a, 100] (* Jean-François Alcover, Jul 29 2020 *)
PROG
(PARI) A277847(n)={prod( i=1, #n=factor(n)~, if(n[1, i]>2, 1 + n[1, i]>>valuation(n[1, i]-1, 2) * n[1, i]^(n[2, i]-1), 2))}
(PARI) a(n, f=factor(n)~)=prod(i=1, #f, (n=eulerphi(f[1, i]^f[2, i]))>>valuation(n, 2)+1) \\ about 10% slower than the above
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
M. F. Hasler, Nov 10 2016
STATUS
approved