Determine
four distinct nonnegative integers A,
B,
C, and
D that satisfy this equation:
2A + 3B + 7C + 12D = 2021
*** For an extra challenge, solve this puzzle without using a computer program/excel solver assisted method.
clc, clearvars
for yr=2020:2025
fprintf('%4d ',yr)
for a=0:floor(log(yr)/log(2))
for b=0:floor(log(yr)/log(3))
for c=0:floor(log(yr)/log(7))
for d=0:floor(log(yr)/log(12))
if 2^a+3^b+7^c+12^d == yr
fprintf('%2d',[a b c d])
end
end
end
end
end
fprintf('\n')
end
finds
a b c d
2020
2021 0 5 2 3 Current puzzle solution
2022 1 5 2 3
2023
2024 2 5 2 3
2025
for some recent and near-future year numbers.
|
Posted by Charlie
on 2023-04-05 10:13:29 |