clearvars, clc
v1=0; v2=0; n1=1; n2=-1;
while v1<10000 || v2<100000
v1=12*n1^2+12*n1+11;
if v1>999 && v1<10000
v=num2str(v1);
good=true;
for i=2:4
if v(i)~=v(i-1)
good=false;
break
end
end
if good
disp([n1 v1])
end
end
n1=n1+1;
v2=12*n2^2+12*n2+11;
if v2>999 && v2<10000
v=num2str(v2);
good=true;
for i=2:4
if v(i)~=v(i-1)
good=false;
break
end
end
if good
disp([n2 v2])
end
end
n2=n2-1;
end
finds
n 12n^2 + 12n + 11
21 5555
-22 5555
|
Posted by Charlie
on 2021-07-20 13:25:16 |