塔利班
发表于 2018-2-9 22:08:52
import math as m
for i in range(1000000,99999999):
if i%11==0 and m.sqrt(i)==int(m.sqrt(i)) and len(set(str(i)))==8:
print(i)
fan1993423
发表于 2018-3-17 21:50:52
import math
a=range(10000000,100000000)
g=[]
for b in a:
g.append(b)
if len(set(g))==8 and int(g)+int(g)+int(g)+int(g)==int(g)+int(g)+int(g)+int(g) and (int(math.sqrt(int(a))))**2==int(a):
print(g)
else:
print('没有这样的数')
凌九霄
发表于 2018-3-31 00:46:24
import itertools, math
lst = itertools.permutations(range(10), 8)
newlst = + x + x + x == x + x + x + x and x != 0]
for i in newlst:
num = i * 10 ** 7 + i * 10 ** 6 + i * 10 ** 5 + i * 10 ** 4 + i * 10 ** 3 + i * 10 ** 2 + i[
6] * 10 + i
result = math.sqrt(num)
if result == int(result):
print(num)
新手潘包邮
发表于 2018-5-6 09:41:22
import itertools as it
def fun():
for i in it.permutations(["0","1","2","3","4","5","6","7","8","9"], 8):
if i == "0":
continue
else:
odd = int(i)+int(i)+int(i)+int(i)
even = int(i)+int(i)+int(i)+int(i)
#print(odd)
#print(i)
if odd == even:
#print(i)
num = int("".join(i))
if num**.5%1 == 0:
print(num)
fun()
咕咕鸡鸽鸽
发表于 2019-3-19 11:08:54
from itertools import permutations as per
def fun127():
list1 = []
#1,每一位的数字都不相同。
for each in per(list(range(10)),8):
if each != 0:
#2,第1,3,5,7位数字之后与第2,4,6,8位数字之和相等。
if sum( for i in range(0,8,2)]) == sum( for i in range(1,8,2)]):
#3,此8位数是完全平方数,即其平方根为整数。
temp = int("".join(str(j) for j in each))
if pow(temp,0.5) == int(pow(temp,0.5)):
list1.append(temp)
return list1
print(fun127())
永恒的蓝色梦想
发表于 2019-8-1 18:16:44
def func():
l=[]
for i in range(int(10000000**0.5),int(99999999**0.5+1)):
i=str(i**2)
if len(set(i))==8 and sum(i[::2])==sum(i):l.append(l)
return l
kinkon
发表于 2022-2-28 17:21:04
for i in range(1000, 10000):
f = set(str(i * i))
if '5' not in f and '0' not in f and len(f) == 8:
arr = list(str(i * i))
a = sum(map(int, arr))
b = sum(map(int, arr))
if a == b:
print(i * i)