|
|
A360181
|
|
Numbers k such that the number of odd digits in k! is greater than or equal to the number of even digits.
|
|
0
|
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
If it exists, a(8) > 100000.
|
|
LINKS
|
|
|
EXAMPLE
|
11 is a term since 11! = 39916800, and the numbers of odd and even digits are both 4.
29 is a term since 29!=8841761993739701954543616000000, and the numbers of odd and even digits are 16 and 15 respectively.
|
|
MATHEMATICA
|
Select[Range[0, 500],
Count[IntegerDigits[#!], _?OddQ] >=
Count[IntegerDigits[#!], _?EvenQ] &]
|
|
PROG
|
(Python)
from sympy import factorial as f
def ok(n):
s=str(f(n))
return(sum(1 for k in s if k in '02468')<=sum(1 for k in s if k in '13579'))
print([n for n in range(501) if ok(n)])
(Python)
from math import factorial
from itertools import count, islice
def A360181_gen(startvalue=0): # generator of terms >= startvalue
f = factorial(m:=max(startvalue, 0))
for k in count(m):
if len(s:=str(f)) <= sum(1 for d in s if d in {'1', '3', '5', '7', '9'})<<1:
yield k
f *= k+1
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,more,less
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|