clearvars,clc
rhs=[];
for x=0:100
for y=0:100
v=2*x*y+3*x+2*y;
if v>9 && v<100
rhs=unique([rhs v]);
end
if v==42
disp([x y])
end
end
end
length(rhs)
for i=1:length(rhs)
fprintf('%3d',rhs(i))
if mod(i,29)==0
fprintf('\n')
end
end
nrhs=setdiff(10:99,rhs)
fprintf('\n')
For the RHS = 42:
x y
0 21
2 6
4 3
8 1
14 0
The 87 valid 2-digit values for the right-hand side (including 42) are:
10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 62 63 64 65 66 67 68 69 70
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
that is all 2-digit numbers except
13 29 61
|
Posted by Charlie
on 2023-08-14 09:03:19 |