login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A045547 Numbers whose factorial has '2' as its final nonzero digit. 6
2, 5, 6, 8, 14, 19, 34, 35, 36, 38, 40, 41, 43, 47, 50, 51, 53, 62, 67, 74, 84, 85, 86, 88, 90, 91, 93, 97, 109, 110, 111, 113, 115, 116, 118, 122, 129, 132, 145, 146, 148, 150, 151, 153, 162, 167, 174, 177, 180, 181, 183, 189, 194, 200, 201, 203, 212, 217 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
From Robert Israel, Dec 16 2016: (Start)
If k is in the sequence, then:
if k == 0 (mod 5), k+1 is in the sequence;
if k == 1 (mod 5), k+1 is in A045548;
if k == 2 (mod 5), k+1 is in A045549;
if k == 3 (mod 5), k+1 is in A045550. (End)
LINKS
MAPLE
count:= 0:
r:= 1:
for n from 2 while count < 100 do
r:= r*n;
if r mod 10 = 0 then r:= r/10^padic:-ordp(r, 5) fi;
if r mod 10 = 2 then count:= count+1; A[count]:= n fi;
od: seq(A[i], i=1..100); # Robert Israel, Dec 16 2016
MATHEMATICA
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 & ]
Join[{2}, Select[Range[5, 220], Most[Split[IntegerDigits[#!]]][[-1, 1]] == 2&]] (* Harvey P. Dale, May 04 2016 *)
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 *)
PROG
(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))
is(n)=lnz(n)==2 \\ Charles R Greathouse IV, Dec 16 2016
(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
(Python)
from functools import reduce
from itertools import count, islice
from sympy.ntheory.factor_ import digits
def A045547_gen(startvalue=1): # generator of terms
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)))
A045547_list = list(islice(A045547_gen(), 30)) # Chai Wah Wu, Dec 07 2023
CROSSREFS
Sequence in context: A330226 A242422 A019989 * A127143 A242665 A079256
KEYWORD
nonn,base
AUTHOR
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 09:04 EDT 2024. Contains 371240 sequences. (Running on oeis4.)