login
Numbers whose factorial has '16' as its final two digits before the trailing zeros.
1

%I #21 Dec 29 2021 17:53:39

%S 12,29,32,59,66,72,121,133,144,165,243,258,269,288,293,297,338,340,

%T 368,384,385,391,402,414,464,521,552,558,569,592,599,612,625,626,670,

%U 673,690,704,732,785,835,847,860,865,880,889,949,959,966,986,1018,1080,1102

%N Numbers whose factorial has '16' as its final two digits before the trailing zeros.

%H Charles R Greathouse IV, <a href="/A045554/b045554.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Fi#final">Index entries for sequences related to final digits of numbers</a>

%t f2nzdQ[n_]:=Module[{nf=n!},Mod[nf/10^IntegerExponent[nf],100]==16]; Select[ Range[1000],f2nzdQ] (* _Harvey P. Dale_, May 28 2015 *)

%o (PARI) last(n,k)=if(n*8\9-1<k, n=n!; return(n/10^valuation(n,10)%10^k)); my(m=Mod(1,5^k)); for(i=2,n,m*=i/10^valuation(i,5));lift(chinese(m, Mod(0,2^k))) \\ Gives the last k decimal digits of n!.

%o is(n)=last(n,2)==16 \\ _Charles R Greathouse IV_, Oct 22 2014

%o (PARI) is(n)=my(m=Mod(1,25)); for(i=2,n, m*=i/10^valuation(i,5)); m==16 \\ _Charles R Greathouse IV_, Oct 22 2014

%o (PARI) v=List();m=Mod(1,25);for(n=2,1e6,m*=n/10^valuation(n,5);if(m==16,listput(v,n);if(#v==100, return(Vec(v))))) \\ _Charles R Greathouse IV_, Oct 22 2014

%o (Python)

%o from math import factorial

%o def ok(n): return str(factorial(n)).rstrip("0").endswith("16")

%o print([k for k in range(1103) if ok(k)]) # _Michael S. Branicky_, Dec 29 2021

%Y Cf. A000142 (factorial).

%K nonn,base

%O 1,1

%A _Jeff Burch_