# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a210253 Showing 1-1 of 1 %I A210253 #25 Nov 12 2020 12:05:17 %S A210253 1,2,3,4,5,6,8,8,9,10,11,13,14,16,16,16,17,18,19,20,22,24,24,25,26,27, %T A210253 29,30,32,32,32,32,33,34,35,36,37,40,40,41,42,43,45,46,48,48,48,49,50, %U A210253 51,52,54,56,56,57,58,59,61,62,64,64,64,64,64,65,66,67 %N A210253 Number of distinct residues of all factorials mod 2^n. %C A210253 Theorem. For n>=1, a(n) = A007843(n) - A210255(n). %H A210253 Alois P. Heinz, Table of n, a(n) for n = 0..1000 %e A210253 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. %p A210253 a:= proc(n) local p, m, i, s; %p A210253 p:= 2^n; %p A210253 m:= 1; %p A210253 s:= {}; %p A210253 for i to p while m<>0 do m:= m*i mod p; s:=s union {m} od; %p A210253 nops(s) %p A210253 end: %p A210253 seq(a(n), n=0..100); # _Alois P. Heinz_, Mar 20 2012 %t A210253 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]]; %t A210253 a /@ Range[0, 100] (* _Jean-François Alcover_, Nov 12 2020, after _Alois P. Heinz_ *) %Y A210253 Cf. A000142, A007814, A210255. %K A210253 nonn %O A210253 0,2 %A A210253 _Vladimir Shevelev_, Mar 19 2012 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE