Let n be an integer greater than 1.
If all digits of 1996*n are even, then find the smallest possible value of n.
even=("0"|"2"|"4"|"6"|"8");
odd=("1"|"3"|"5"|"7"|"9");
ct=0;
for n=2:99999
p=num2str(n*1996);
f=strfind(p,odd);
if length(f)==0
disp([n,str2double(p)])
ct=ct+1;
if ct>=20
break
end
end
end
finds the smallest 20 of them:
>> allEvens
333 664668
334 666664
335 668660
343 684628
344 686624
345 688620
433 864268
434 866264
435 868260
443 884228
444 886224
445 888220
1333 2660668
1334 2662664
1335 2664660
1343 2680628
1344 2682624
1345 2684620
1433 2860268
1434 2862264
|
Posted by Charlie
on 2024-10-30 09:03:08 |