OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
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;
add(i, i=s)
end:
seq (a(n), n=0..40); # Alois P. Heinz, Mar 20 2012
MATHEMATICA
a[n_] := Module[{k=0, s={}}, While[(r = Mod[k!, 2^n]) > 0, k++; AppendTo[s, r]]; Total@Union@s]; Array[a, 32, 0] (* Amiram Eldar, Dec 15 2018 *)
PROG
(PARI) nbf(n) = my(k=1); while(k! % 2^n, k++); k; \\ A007843
a(n) = my(nb=nbf(n)); vecsum(Set(vector(nb, k, k! % 2^n))); \\ Michel Marcus, Dec 15 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Mar 20 2012
EXTENSIONS
More terms from Alois P. Heinz, Mar 20 2012
STATUS
approved