A classic problem is to find all rectangles with integer sides such that the numeric values for the area and perimeter are equal.
There are two distinct solutions to this problem. Can you find them, with proof?
A possible variant to the classic problem is to generalize the sides into a pair of arbitrary non-zero
Gaussian integers.
That is, what pairs of non-zero Gaussian integers x and y satisfy x*y=2*(x+y)?
The workings of this program are too hidden to really call it a solution, but it does list the answers.
For the traditional case only positive integers are counted, as it's referring to actual rectangles. The Gaussian case is treated as pure algebra.
clearvars,clc
syms y
for x=1:1000000
yval=solve (x*y==2*(x+y),y);
if yval>0
if yval>=x
if yval==round(yval)
disp([x yval])
end
else
break
end
end
end
clearvars
syms y
for xr=-30:30
for xi=-30:30
yval=solve ((xr+xi*1i)*y==2*((xr+xi*1i)+y),y);
if round(real(yval))==real(yval)
if round(imag(yval))==imag(yval)
x=xr+xi*1i;
disp([x yval])
end
end
end
end
finds
Real integers:
[3, 6]
[4, 4]
Gaussian integers:
[-2, 1]
[-2i, 1 + 1i]
[0, 0]
[2i, 1 - 1i]
[1 - 1i, 2i]
[1, -2]
[1 + 1i, -2i]
[2 - 4i, 2 + 1i]
[2 - 2i, 2 + 2i]
[2 - 1i, 2 + 4i]
[2 + 1i, 2 - 4i]
[2 + 2i, 2 - 2i]
[2 + 4i, 2 - 1i]
[3 - 1i, 4 + 2i]
[3, 6]
[3 + 1i, 4 - 2i]
[4 - 2i, 3 + 1i]
[4, 4]
[4 + 2i, 3 - 1i]
[6, 3]
>>
|
Posted by Charlie
on 2022-12-23 10:06:52 |