OFFSET
0,3
LINKS
FORMULA
a(n+1) = A004151((n+1)*a(n)). - Reinhard Zumkeller, Nov 24 2012, corrected by M. F. Hasler, Oct 16 2014
MAPLE
a:= n-> (f-> f/10^padic[ordp](f, 10))(n!):
seq(a(n), n=0..29); # Alois P. Heinz, Dec 29 2021
MATHEMATICA
Array[#!//.x_/; x~Mod~5==0:>x/10&, 22] (* Giorgos Kalogeropoulos, Aug 17 2020 *)
Join[{1, 1, 2, 6, 24}, Table[FromDigits[Flatten[Most[Split[IntegerDigits[n!]]]]], {n, 5, 30}]] (* or *) Table[n!/10^IntegerExponent[n!, 10], {n, 0, 30}] (* Harvey P. Dale, Feb 13 2024 *)
PROG
(Haskell)
a004154 = a004151 . a000142
a004154_list = scanl (\u v -> a004151 $ u * v) 1 [1..]
-- Reinhard Zumkeller, Nov 24 2012
(PARI) a(n)=n!/10^valuation(n!, 5) \\ M. F. Hasler, Oct 16 2014
(Magma) [Factorial(n)/10^Valuation(Factorial(n), 5): n in [0..30]]; // Vincenzo Librandi, Oct 16 2014
(Python)
from sympy import factorial
from sympy.ntheory.factor_ import digits
def A004154(n): return factorial(n)//10**(n-sum(digits(n, 5)[1:])>>2) # Chai Wah Wu, Oct 18 2024
CROSSREFS
KEYWORD
nonn,base,changed
AUTHOR
STATUS
approved