OFFSET
0,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
EXAMPLE
Let n=2. We have modulo 4: 0!=1!==1, 2!==3!==2, for n>=4, n!==0. Thus the distinct residues are 0,1,2. Therefore, a(2) = 3.
MAPLE
a:= proc(n) local p, m, i, s;
p:= 2^n;
m:= 1;
s:= {};
for i to p while m<>0 do m:= m*i mod p; s:=s union {m} od;
nops(s)
end:
seq(a(n), n=0..100); # Alois P. Heinz, Mar 20 2012
MATHEMATICA
a[n_] := Module[{p = 2^n, m = 1, i, s = {}}, For[i = 1, i <= p && m != 0, i++, m = Mod[m i, p]; s = Union[s, {m}]]; Length[s]];
a /@ Range[0, 100] (* Jean-François Alcover, Nov 12 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Mar 19 2012
STATUS
approved