A137582
Numbers having no inner zeros in decimal representation of their factorial.
Original entry on oeis.org
0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 14, 31, 40
Offset: 1
A000142(a(10)) = 11! = 399168*10^2;
A000142(a(11)) = 14! = 871782912*10^2;
A000142(a(12)) = 31! = 822283865417792281772556288*10^7.
-
isok(k) = my(f=k!); while(!(f % 10), f \= 10); #select(x->(x == 0), digits(f)) == 0; \\ Michel Marcus, Jun 28 2023
A165753
Number of trailing zeros in sequence of factorials of Fibonacci numbers.
Original entry on oeis.org
0, 0, 0, 0, 1, 1, 2, 4, 7, 13, 20, 34, 56, 93, 150, 244, 396, 643, 1043, 1689, 2733, 4425, 7161, 11587, 18754, 30344, 49100, 79449, 128552, 208007, 336563, 544573, 881140, 1425715, 2306860, 3732583, 6039449, 9772038, 15811490, 25583533, 41395029
Offset: 1
F(7)!=13!=6227020800 which ends with 2 zeros; therefore a(7)=2.
- C. Suriano, Miniature Matematiche, Il rosone, 2009, pp. 149-152.
-
zOF[n_Integer?Positive]:=Module[{maxpow=0},While[5^maxpow<=n,maxpow++];Plus@@Table[Quotient[n,5^i],{i,maxpow-1}]];zOF[#]&/@ Fibonacci[ Range[ 50]] (* Harvey P. Dale, Jan 10 2020 *)
A175417
Exponent of 2 minus sum of all other exponents, in the prime power factorization of n!
Original entry on oeis.org
0, 0, 1, 0, 2, 1, 1, 0, 3, 1, 1, 0, 1, 0, 0, -2, 2, 1, 0, -1, 0, -2, -2, -3, -1, -3, -3, -6, -5, -6, -7, -8, -3, -5, -5, -7, -7, -8, -8, -10, -8, -9, -10, -11, -10, -13, -13, -14, -11, -13, -14, -16, -15, -16, -18, -20, -18, -20, -20, -21, -21, -22, -22, -25, -19, -21, -22
Offset: 0
a(20) = 0 because 20! = 2432902008176640000 = ((2^18)*(3^8)*(5^4)*(7^2)*(11^1)*(13^1)*(17^1)*(19^1)) and 18-(8+4+2+1+1+1+1) = 0.
-
f:= proc(n) local t,p,k;
p:= 2: t:= add(floor(n/2^k),k=1..ilog2(n)):
do
p:= nextprime(p);
if n < p then return t fi;
t:= t - add(floor(n/p^k),k=1..ilog[p](n))
od
end proc:
map(f, [$0..100]); # Robert Israel, Nov 10 2024
-
Table[2*IntegerExponent[m!,2]-Total[Last/@FactorInteger[m! ]],{m,0,130}]
A181578
The number k such that each of the five factorials (5k+j)!, j=0..4, has exactly n trailing zeros in its base-10 representation; 0 if no such k exists.
Original entry on oeis.org
0, 1, 2, 3, 4, 0, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 0, 15, 16, 17, 18, 19, 0, 20, 21, 22, 23, 24, 0, 0, 25, 26, 27, 28, 29, 0, 30, 31, 32, 33, 34, 0, 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, 44, 0, 45, 46, 47, 48, 49, 0, 0, 50, 51, 52, 53, 54, 0, 55, 56, 57, 58, 59, 0, 60, 61, 62, 63
Offset: 0
A181581
Smallest k such that each of the five factorials (5k)!, (5k+1)!, (5k+2)!, (5k+3)! and (5k+4)! has exactly 10^n trailing 0's. Zero, if no such k exists.
Original entry on oeis.org
1, 9, 81, 801, 8002, 80001, 800001, 8000002, 80000003, 800000003, 8000000003, 80000000003, 800000000002, 8000000000003, 80000000000004, 0, 0, 0, 800000000000000004, 8000000000000000003, 0, 800000000000000000005, 8000000000000000000006, 0
Offset: 0
A218976
a(n) is the smallest positive integer such that 10^(2 + floor(k/a(1)) + floor(k/a(2)) + ... + floor(k/a(n))) divides (k+9)! for all k > 0.
Original entry on oeis.org
6, 16, 116, 241, 242, 491, 991, 2491, 3331, 14966, 15556, 62491, 78116, 83331, 249991, 264866, 546841, 1109366, 2265491, 4999861, 4999991, 5837041, 12499996, 25249861, 26011861, 36249091, 80070866, 190999991, 242090611, 365038621, 976562241, 1210466866, 1830622801
Offset: 1
10^(2 + floor(5/5)) does not divide 14!, so a(1) > 5. But 10^(2 + floor(k/6)) divides (k+9)! for all k > 0, so a(1) = 6.
-
searchLimit(s1)={
my(e,s2,f=(e,s)->(e+2-9*s)/(s-s1));
while(s2<=s1, s2 += 1/5^e++);
min(f(e,s2), f(e++,s2+=1/5^e))\1
};
v5(n)=my(s);while(n\=5,s+=n);s;
nxt(v=[6])={
my(S=sum(i=1,#v,1/v[i]), candidate=max(v[#v],1\(1/4-S))+1, k=candidate, lm=searchLimit(S+1/candidate));
while(k<=lm,
if(v5(k+9)<2+sum(i=1,#v,k\v[i])+k\candidate,
candidate++;
lm=searchLimit(S+1/candidate)
,
k++
)
);
candidate
};
steps(n)={
my(v=[6],t);
print1(6);
for(i=2,n,
t=nxt(v);
print1(", "t);
v=concat(v,t)
);
v
};
steps(20)
A228311
Numbers k such that the sum of digits of k! is itself a factorial.
Original entry on oeis.org
0, 1, 2, 3, 4, 21966, 176755, 182624820
Offset: 1
The sum of the digits of 21966! is 362880 = 9!.
The sum of the digits of 176755! is 3628800 = 10!.
The sum of the digits of 182624820! is 6227020800 = 13!.
-
lst = {0}; k = p = 1; fctl = Range@ 15!; While[k < 180000, p = p*k; While[ Mod[p, 10] == 0, p /= 10]; If[ MemberQ[ fctl, Plus @@ IntegerDigits@ p], Print[k]; AppendTo[lst, k]]; k++]; lst (* Robert G. Wilson v, Feb 18 2014 *)
With[{fcts=Range[20]!},Select[Range[0,22000],MemberQ[fcts,Total[IntegerDigits[#!]]]&]] (* Harvey P. Dale, Jan 06 2024 *)
-
lpf(n)=my(f=factor(n)[,1]); f[1]
factorial_lval(n, p)={
my(s);
while(n\=p, s+=n);
s
};
isfactorial(n)={
if(n<3, return(n>0));
my(v2=valuation(n,2),mn=v2+1,mx=mn+log(v2+1.5)\log(2),t,c);
while (mx - mn > 1,
t = mn + (mx - mn)\2;
c = factorial_lval(t, 2);
if (c < v2,
mn = t+1
,
if (c > v2,
mx = t-1
,
mx = bitor(t,1);
mn = max(mn, mx-1)
)
)
);
if (mn < mx,
my(p=lpf(mx));
t = valuation(n, p);
c = factorial_lval(mx, p);
if (t > c,return(0));
if (t == c,
mn = mx
)
);
n==mn!
};
is(n)=isfactorial(sumdigits(n!))
A255400
a(n) is the smallest nonnegative integer such that a(n)! contains a string of exactly n consecutive 0's.
Original entry on oeis.org
0, 5, 10, 15, 20, 264, 25, 30, 35, 40, 45, 101805, 50, 55, 60, 65, 70
Offset: 0
a(0) = 0 as 0! = 1 does not contain '0'.
a(1) = 5 as 5! = 120 contains '0'.
a(2) = 10 as 10! = 3628800 contains '00' and 10 is the smallest integer for which the condition is met.
-
\\ uses is() from A000966
f(k, special, sz, sz1) = my(f=k!); if (special, s=Str(f/10^valuation(f, 10)), s=Str(k!)); #strsplit(s, sz) - #strsplit(s, sz1);
a(n) = if (n==0, return(0)); my(sz= concat(vector(n, k, "0")), sz1=concat(sz, "0"), k=1,special=is(n)); while (f(k, special, sz, sz1) != 1, k++); k; \\ Michel Marcus, Oct 25 2023
-
# Python version 2.7
from math import factorial as fct
def trailing_zero(n):
k=0
while n!=0:
n/=5
k+=n
return k
def A255400():
index = 1
f = 1
while True:
if trailing_zero(f) == index:
print("A255400("+str(index)+") = " +str(f))
index += 1
elif trailing_zero(f) > index:
while True:
clnzer = str(fct(f))[:-trailing_zero(f)]
if index*'0' in clnzer and (index+1)*'0' not in clnzer:
print("A255400("+str(index)+") = " +str(f))
index += 1
f = 0
break
f +=1
f +=1
return
-
import re
def A255400(n):
f, i, s = 1, 0, re.compile('[0-9]*[1-9]0{'+str(n)+'}[1-9][0-9]*')
while s.match(str(f)+'1') is None:
i += 1
f *= i
return i # Chai Wah Wu, Apr 02 2015
A354463
a(n) is the number of trailing zeros in (2^n)!.
Original entry on oeis.org
0, 0, 0, 1, 3, 7, 14, 31, 63, 126, 253, 509, 1021, 2045, 4094, 8189, 16380, 32763, 65531, 131067, 262140, 524285, 1048571, 2097146, 4194297, 8388603, 16777208, 33554424, 67108858, 134217720, 268435446, 536870902, 1073741816, 2147483642, 4294967289, 8589934584, 17179869176, 34359738358, 68719476729
Offset: 0
For n = 4, (2^4)! = 20922789888000, which has a(4) = 3 trailing zeros.
-
seq n = aux (2 ^ n) 0
where
aux x acc
| x < 5 = acc
| otherwise = aux y (acc + y)
where
y = x `div` 5
-
a[n_]:=IntegerExponent[(2^n)!]; Array[a,38,0] (* Stefano Spezia, Jun 01 2022 *)
-
a(n) = val(1<David A. Corneth, Jun 01 2022
-
from sympy import factorial, multiplicity
def a(n): return multiplicity(5, factorial(2**n, evaluate=False))
print([a(n) for n in range(39)]) # Michael S. Branicky, Jun 01 2022
-
def A354463(n):
c, m = 0, 2**n
while m >= 5:
m //= 5
c += m
return c # Chai Wah Wu, Jun 02 2022
A381886
Triangle read by rows: T(n, k) = Sum_{j=1..floor(log[k](n))} floor(n / k^j) if k >= 2, T(n, 1) = n, T(n, 0) = 0^n.
Original entry on oeis.org
1, 0, 1, 0, 2, 1, 0, 3, 1, 1, 0, 4, 3, 1, 1, 0, 5, 3, 1, 1, 1, 0, 6, 4, 2, 1, 1, 1, 0, 7, 4, 2, 1, 1, 1, 1, 0, 8, 7, 2, 2, 1, 1, 1, 1, 0, 9, 7, 4, 2, 1, 1, 1, 1, 1, 0, 10, 8, 4, 2, 2, 1, 1, 1, 1, 1, 0, 11, 8, 4, 2, 2, 1, 1, 1, 1, 1, 1, 0, 12, 10, 5, 3, 2, 2, 1, 1, 1, 1, 1, 1
Offset: 0
Triangle starts:
[ 0] 1;
[ 1] 0, 1;
[ 2] 0, 2, 1;
[ 3] 0, 3, 1, 1;
[ 4] 0, 4, 3, 1, 1;
[ 5] 0, 5, 3, 1, 1, 1;
[ 6] 0, 6, 4, 2, 1, 1, 1;
[ 7] 0, 7, 4, 2, 1, 1, 1, 1;
[ 8] 0, 8, 7, 2, 2, 1, 1, 1, 1;
[ 9] 0, 9, 7, 4, 2, 1, 1, 1, 1, 1;
[10] 0, 10, 8, 4, 2, 2, 1, 1, 1, 1, 1;
[11] 0, 11, 8, 4, 2, 2, 1, 1, 1, 1, 1, 1;
[12] 0, 12, 10, 5, 3, 2, 2, 1, 1, 1, 1, 1, 1;
-
T := (n, b) -> local i; ifelse(b = 0, b^n, ifelse(b = 1, n, add(iquo(n, b^i), i = 1..floor(log(n, b))))): seq(seq(T(n, b), b = 0..n), n = 0..12);
# Alternative:
T := (n, k) -> local j; ifelse(k = 0, k^n, ifelse(k = 1, n, add(padic:-ordp(j, k), j = 1..n))): for n from 0 to 12 do seq(T(n, k), k = 0..n) od;
-
T[n_, 0] := If[n == 0, 1, 0]; T[n_, 1] := n;
T[n_, k_] := Last@Accumulate[IntegerExponent[Range[n], k]];
Table[T[n, k], {n, 0, 12}, {k, 0, n}] // MatrixForm
(* Alternative: *)
T[n_, k_] := Sum[Floor[n/k^j], {j, Floor[Log[k, n]]}]; T[n_, 1] := n; T[n_, 0] := 0^n; T[0, 0] = 1; Flatten@ Table[T[n, k], {n, 0, 12}, {k, 0, n}] (* Michael De Vlieger, Apr 03 2025 *)
-
T(n,k) = if (n==0, 1, if (n==1, k, if (k==0, 0, if (k==1, n, sum(j=1, n, valuation(j, k))))));
row(n) = vector(n+1, k, T(n,k-1)); \\ Michel Marcus, Apr 04 2025
-
from math import log
def T(n: int, b: int) -> int:
return (b**n if b == 0 else n if b == 1 else
sum(n // (b**i) for i in range(1, 1 + int(log(n, b)))))
print([[T(n, b) for b in range(n+1)] for n in range(12)])
-
def T(n, b): return (b^n if b == 0 else n if b == 1 else sum(valuation(j, b) for j in (1..n)))
print(flatten([[T(n, b) for b in range(n+1)] for n in srange(13)]))
Comments