|
|
A045548
|
|
Numbers whose factorial has '4' as its final nonzero digit.
|
|
6
|
|
|
4, 7, 20, 21, 23, 25, 26, 28, 37, 42, 49, 52, 55, 56, 58, 64, 69, 75, 76, 78, 87, 92, 99, 100, 101, 103, 112, 117, 124, 134, 135, 136, 138, 140, 141, 143, 147, 152, 155, 156, 158, 164, 169, 179, 182, 195, 196, 198, 202, 205, 206, 208, 214, 219
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
If n is in the sequence, then:
if n == 0 (mod 5), n+1 is in the sequence;
if n == 1 (mod 5), n+1 is in A045550;
if n == 2 (mod 5), n+1 is in A045547;
if n == 3 (mod 5), n+1 is in A045549. (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 = 4 then count:= count+1; A[count]:= n fi;
|
|
MATHEMATICA
|
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[#] == 4 &] (* Robert G. Wilson v, Dec 28 2016 *)
|
|
PROG
|
(Python)
from itertools import count, islice
from functools import reduce
from sympy.ntheory.factor_ import digits
def A045548_gen(startvalue=1): # generator of terms >= startvalue
return filter(lambda n:4==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, 1)))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|