软件编程版 #642491 层

第 64249 号话题

楼主 · 1 楼


用matlab写的程序在下面,很低能的一个

a = 4183:94:
65536;
cnt = length(a);
ansmat = [];
for i = 1:cnt
x = a(i);
mat1 = [];
while x>=10
mat1 = [mat1,mod(x,10)];
x = floor(x./10);
end
mat1 = [mat1,x];
mat2 = [];

x = a(i);
while x>=16
mat2 = [mat2,mod(x,16)];
x = floor(x./16);
end
mat2 = [mat2,x];

bool1 = 0;
bool2 = 0;
cnt1 = length(mat1);
for j = 1:cnt1-1
for k = j+1:cnt1
if mat1(j)==mat1(k)
bool1 = 1;
end
end
end

cnt1 = length(mat2);
for j = 1:cnt1-1
for k = j+1:cnt1
if mat2(j)==mat2(k)
bool2 = 1;
end
end
end

if bool1 && bool2 && isprime(a(i)./47)
ansmat =[ ansmat a(i)];
end

end