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.

A045547 Numbers whose factorial has '2' as its final nonzero digit.

This page as a plain text file.
%I A045547 #44 Dec 07 2023 11:40:18
%S A045547 2,5,6,8,14,19,34,35,36,38,40,41,43,47,50,51,53,62,67,74,84,85,86,88,
%T A045547 90,91,93,97,109,110,111,113,115,116,118,122,129,132,145,146,148,150,
%U A045547 151,153,162,167,174,177,180,181,183,189,194,200,201,203,212,217
%N A045547 Numbers whose factorial has '2' as its final nonzero digit.
%C A045547 From _Robert Israel_, Dec 16 2016: (Start)
%C A045547 If k is in the sequence, then:
%C A045547 if k == 0 (mod 5), k+1 is in the sequence;
%C A045547 if k == 1 (mod 5), k+1 is in A045548;
%C A045547 if k == 2 (mod 5), k+1 is in A045549;
%C A045547 if k == 3 (mod 5), k+1 is in A045550. (End)
%H A045547 Robert Israel, <a href="/A045547/b045547.txt">Table of n, a(n) for n = 1..10000</a>
%H A045547 <a href="/index/Fi#final">Index entries for sequences related to final digits of numbers</a>
%p A045547 count:= 0:
%p A045547 r:= 1:
%p A045547 for n from 2 while count < 100 do
%p A045547   r:= r*n;
%p A045547   if r mod 10 = 0 then r:= r/10^padic:-ordp(r, 5) fi;
%p A045547   if r mod 10 = 2 then count:= count+1; A[count]:= n fi;
%p A045547 od: seq(A[i], i=1..100); # _Robert Israel_, Dec 16 2016
%t A045547 f[ n_Integer, m_Integer ] := (c = 0; p = 1; While[ d = Floor[ n/5^p ]; d > 0, c = c + d; p++ ]; Mod[ n!/10^c, m ] ); Select[ Range[ 250 ], f[ #, 10 ] == 2 & ]
%t A045547 Join[{2},Select[Range[5,220],Most[Split[IntegerDigits[#!]]][[-1,1]] == 2&]] (* _Harvey P. Dale_, May 04 2016 *)
%t A045547 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[#] == 2 &] (* _Robert G. Wilson v_, Dec 28 2016 *)
%o A045547 (PARI) lnz(n)=if(n<2, return(1)); my(m=Mod(1,5)); for(k=2,n, m*=k/10^valuation(k,5)); lift(chinese(Mod(0,2),m))
%o A045547 is(n)=lnz(n)==2 \\ _Charles R Greathouse IV_, Dec 16 2016
%o A045547 (PARI) list(lim)=my(v=List(),m=Mod(1,5)); for(k=2,lim, m*=k/10^valuation(k,5); if(m==2, listput(v, k))); Vec(v) \\ _Charles R Greathouse IV_, Dec 16 2016
%o A045547 (Python)
%o A045547 from functools import reduce
%o A045547 from itertools import count, islice
%o A045547 from sympy.ntheory.factor_ import digits
%o A045547 def A045547_gen(startvalue=1): # generator of terms
%o A045547     return filter(lambda n:2==reduce(lambda x,y:x*y%10,((1,1,2,6,4)[a]*((6,2,4,8)[i*a&3] if i*a else 1) for i, a in enumerate(digits(n,5)[-1:0:-1])))*6%10, count(max(startvalue,1)))
%o A045547 A045547_list = list(islice(A045547_gen(),30)) # _Chai Wah Wu_, Dec 07 2023
%Y A045547 Cf. A008904, A045548, A045549, A045550.
%K A045547 nonn,base
%O A045547 1,1
%A A045547 _Jeff Burch_