cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A045549 Numbers whose factorial has '6' as its final nonzero digit.

This page as a plain text file.
%I A045549 #36 Sep 27 2024 14:00:35
%S A045549 3,12,17,24,29,32,45,46,48,59,60,61,63,65,66,68,72,79,82,95,96,98,104,
%T A045549 107,120,121,123,127,130,131,133,139,144,159,160,161,163,165,166,168,
%U A045549 172,175,176,178,187,192,199,209,210,211,213,215,216,218
%N A045549 Numbers whose factorial has '6' as its final nonzero digit.
%C A045549 From _Robert Israel_, Dec 16 2016: (Start)
%C A045549 If n is in the sequence, then:
%C A045549 if n == 0 (mod 5), n+1 is in the sequence;
%C A045549 if n == 1 (mod 5), n+1 is in A045547;
%C A045549 if n == 2 (mod 5), n+1 is in A045550;
%C A045549 if n == 3 (mod 5), n+1 is in A045548. (End)
%H A045549 Robert Israel, <a href="/A045549/b045549.txt">Table of n, a(n) for n = 1..10000</a>
%H A045549 <a href="/index/Fi#final">Index entries for sequences related to final digits of numbers</a>
%p A045549 count:= 0:
%p A045549 r:= 1:
%p A045549 for n from 2 while count < 100 do
%p A045549   r:= r*n;
%p A045549   if r mod 10 = 0 then r:= r/10^padic:-ordp(r,5) fi;
%p A045549   if r mod 10 = 6 then count:= count+1; A[count]:= n fi;
%p A045549 od:
%p A045549 seq(A[i],i=1..100); # _Robert Israel_, Dec 16 2016
%t A045549 Join[{3}, Select[Range[5,250], Most[Split[IntegerDigits[#!]]][[-1, 1]] == 6 &]] (* _Vincenzo Librandi_, Dec 16 2016 *)
%t A045549 f[n_] := Mod[6 Times @@ (Rest[ FoldList[{1 + #1[[1]], #2! 2^(#1[[1]] #2)} &, {0, 0}, Reverse[ IntegerDigits[n, 5]]]]), 10][[2]] (* after _Jacob A. Siehler_ & _Greg Dresden_ in A008904 *); f[0] = f[1] = 1; Select[ Range[150], f[#] == 6 &] (* _Robert G. Wilson v_, Dec 28 2016 *)
%t A045549 Select[Range[250],With[{f=#!},Drop[IntegerDigits[f],-IntegerExponent[f]][[-1]]]==6&] (* _Harvey P. Dale_, Sep 27 2024 *)
%o A045549 (Python)
%o A045549 from itertools import count, islice
%o A045549 from functools import reduce
%o A045549 from sympy.ntheory.factor_ import digits
%o A045549 def A045549_gen(startvalue=2): # generator of terms >= startvalue
%o A045549     return filter(lambda n:6==reduce(lambda x,y:x*y%10,(((6,2,4,8,6,2,4,8,2,4,8,6,6,2,4,8,4,8,6,2)[(a<<2)|(i*a&3)] if i*a else (1,1,2,6,4)[a]) for i, a in enumerate(digits(n,5)[-1:0:-1])),6), count(max(startvalue,2)))
%o A045549 A045549_list = list(islice(A045549_gen(),30)) # _Chai Wah Wu_, Dec 07 2023
%Y A045549 Cf. A008904, A045547, A045548, A045550.
%K A045549 nonn,base
%O A045549 1,1
%A A045549 _Jeff Burch_