N is a positive integer divisible by 7, and N does NOT contain the digit 9.
Devise an algorithm to lexicographically list all valid values of N ≤ 2022.
(In reply to
solution by Charlie)
Added on:
c=sort(num2roman(str2double(b)));
for i=1:length(c)
fprintf('%-5s \n', (c{i}))
end
giving
CCCI
CCCL
CCCLVII
CCCLXIV
CCCLXXI
CCCLXXVIII
CCCLXXXV
CCCVIII
CCCXLIII
CCCXV
CCCXXII
CCCXXXVI
CCIII
CCLII
CCLXVI
CCLXXIII
CCLXXX
CCLXXXVII
CCX
CCXLV
CCXVII
CCXXIV
CCXXXI
CCXXXVIII
CDLV
CDLXII
CDLXXVI
CDLXXXIII
CDVI
CDXIII
CDXLI
CDXLVIII
CDXX
CDXXVII
CDXXXIV
CLIV
CLXI
CLXVIII
CLXXV
CLXXXII
CV
CXII
CXL
CXLVII
CXXVI
CXXXIII
DCC
DCCCLIV
DCCCLXI
DCCCLXVIII
DCCCLXXV
DCCCLXXXII
DCCCV
DCCCXII
DCCCXL
DCCCXLVII
DCCCXXVI
DCCCXXXIII
DCCLVI
DCCLXIII
DCCLXX
DCCLXXVII
DCCLXXXIV
DCCVII
DCCXIV
DCCXLII
DCCXXI
DCCXXVIII
DCCXXXV
DCII
DCLI
DCLVIII
DCLXV
DCLXXII
DCLXXXVI
DCXLIV
DCXVI
DCXXIII
DCXXX
DCXXXVII
DIV
DLIII
DLX
DLXVII
DLXXIV
DLXXXI
DLXXXVIII
DXI
DXLVI
DXVIII
DXXV
DXXXII
LVI
LXIII
LXX
LXXVII
LXXXIV
MCCCII
MCCCLI
MCCCLVIII
MCCCLXV
MCCCLXXII
MCCCLXXXVI
MCCCXLIV
MCCCXVI
MCCCXXIII
MCCCXXX
MCCCXXXVII
MCCIV
MCCLIII
MCCLX
MCCLXVII
MCCLXXIV
MCCLXXXI
MCCLXXXVIII
MCCXI
MCCXLVI
MCCXVIII
MCCXXV
MCCXXXII
MCD
MCDLVI
MCDLXIII
MCDLXX
MCDLXXVII
MCDLXXXIV
MCDVII
MCDX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