OFFSET
2,1
COMMENTS
a(n)! > n. - Robert Israel, Aug 17 2014
LINKS
Dimitri Zucker, Factorial Fact Frenzy (!), Combo Class Youtube video (2022).
EXAMPLE
The sum of the base-2 digits of 10! is 1+1+0+1+1+1+0+1+0+1+1+1+1+1+0+0+0+0+0+0+0+0=11, which does not divide 10!. Since the sum of the base-2 digits of k! divides k! for 0 <= k <= 9, a(2) = 10.
The sum of the base-3 digits of 43! is 106, which does not divide 43!. Since the sum of the base-3 digits of k! divides k! for 0 <= k <= 42, a(3) = 43.
MAPLE
f:= proc(n)
local f, k;
for k from 1 do
f:= k!;
if f mod convert(convert(f, base, n), `+`) <> 0 then return k fi;
od
end proc:
seq(f(n), n=2..30); # Robert Israel, Aug 10 2014
MATHEMATICA
a245663[n_Integer] := Module[{f = 2, k = 2}, While[Divisible[f, Total[IntegerDigits[f, n]]] == True, k++; f = k!]; k]; a245663 /@ Range[2, 50] (* Michael De Vlieger, Aug 15 2014 *)
PROG
(Haskell)
fac :: Integer -> Integer
fac 0 = 1
fac n = foldl (*) 1 [2..n]
base 0 b = []
base a b = (a `mod` b) : base ((a-(a `mod` b)) `div` b) b
bAse a b = reverse (base a b)
sigbAse a b = foldl (+) 0 (bAse a b)
f n = [k | k <- [1..], not ((fac k) `mod` (sigbAse (fac k) n) == 0)] !! 0
main = print (map f [2..20]) -- generates values for n = 2 through 20. May be slow for values over 30.
(PARI) sumd(k, n) = my(d = digits(k, n)); sum(j=1, #d, d[j]);
a(n) = {k = 2; fk = k!; while (fk % sumd(fk, n) == 0, k++; fk = k!); k; } \\ Michel Marcus, Aug 10 2014
CROSSREFS
KEYWORD
nonn,base
AUTHOR
G. H. Faust, Jul 28 2014
STATUS
approved