好难
>> a=-1
>>> k=1
>>> while k == 135135:
k=a*(a+2)*(a+4)*(a+6)*(a+8)*(a+10)
if k == 13135:
print(a)
a=a+2
num=1
for i in range(1,135136,2):
for j in range(0,11,2):
num*=(i+j)
if(num==135135):
break
num=1
print(i)
for i in range(1,100,2):
c = 1
for j in range(6):
c = c * ( i + 2 * j)
if c == 135135:
print(i)
break
饼饼呀 发表于 2018-2-2 19:47
for num1 in range(0,100):
num1 / 2 != 0
num2 = num1 + 2
谢谢版主。
def diGui(start):
sum = 1
for x in range(start,start + 12,2):
sum = sum * x
if sum == 135135:
print(start)
else:
start = start + 2
diGui(start)
num = 135135
kaifang = int(num ** (1/6))
start = 0
if (kaifang - 6) > 0 and (kaifang % 2 == 1):
start = kaifang - 6
else:
start = 1
diGui(start)
本帖最后由 我爱鲁能 于 2018-2-6 15:56 编辑
def calculate(number):
i=-1
result=0
while True:
if result==number:
break
else:
i+=2
result=i*(i+2)*(i+4)*(i+6)*(i+8)*(i+10)
return i
print('第一个数是%d' %calculate(135135))
def calc(i):
return (i * (i+2) * (i+4) * (i+6) * (i+8) * (i+10))
def main():
i = 1
while True:
if calc(i) == 135135:
print('i的最小值为:', i)
break
else:
i += 2
if __name__ == '__main__':
main()
最终结果是:3
x = 1
while 1:
if x * (x+2) * (x+4) * (x+6) * (x+8) * (x+10) == 135135:
print(x)
break
else:
x = x+1
3
def minOdd(p = 135135, n = 6):
y = int(p**(1/n))//2*2+1
for x in range(y, 1, -2):
q = 1
for i in range(n):
q *= x + 2*i
if q == p:
return x
def mix(mi):
mixture = 1
for i in range(6):
mixture *= mi
mi += 2
return mixture
for j in range(1,1000,2):
if mix(j) == 135135:
print(j)
break
3
我是初学者
def fun1():
lis1=
for each in lis1:
if each*(each+2)*(each+4)*(each+6)*(each+8)*(each+10)==135135:
print(each)
break
fun1()
看了一些答案,大多数只考虑了正奇数。。。那么负的答案是否会更小,更符合题意?
冷小漠 发表于 2018-2-8 13:16
看了一些答案,大多数只考虑了正奇数。。。那么负的答案是否会更小,更符合题意?
是的,6个连续负奇数也可以,题目应该说明只考虑正数就严谨了。
i = 1
while (i * (i + 2) * (i + 4) * (i + 6) * (i + 8) * (i + 10)) != 135135 :
i += 2
print(i)
x = 1
while x * (x + 2) * (x + 4) * (x + 6) * (x + 8) * (x + 10) != 135135:
x += 2
print(x)
i =1
ls = []
prod = 0
while True:
ls.append(i)
if len(ls) == 6:
prod =ls*ls*ls*ls*ls*ls
if prod ==135135:
print(ls)
print('最小的奇数是:',min(ls))
break
else:
del ls
i += 2
n = 1
while True:
if n * (n + 2) * (n + 4) * (n + 6) * (n + 8) * (n + 10) != 135135:
n += 1
else:
print(n)
break
def fun(num):
num_list =
#return num_list
for i in num_list:
count = 1
a= i+2
while a in num_list:
count += 1
a += 2
if count >= 5:
return i
pass
fun(135135)
for i in range(11) :
if i * (i + 2) * (i + 4) * (i + 6) * (i + 8) * (i + 10) == 135135 :
print(i)