Question Number 188879 by Nimnim111118 last updated on 08/Mar/23
$${Find}\:{the}\:{sum}\:{of}\:{all}\:{three}\:{digit}\:{numbers} \\ $$$${started}\:{with}\:{odd}\:{number}\:{when}\:{each}\:{digit} \\ $$$${are}\:{different}. \\ $$$$ \\ $$$${Please}\:{help}… \\ $$
Commented by mr W last updated on 08/Mar/23
$${do}\:{you}\:{know}\:{the}\:{answer}? \\ $$
Commented by Nimnim111118 last updated on 08/Mar/23
$${Sorry},\:{I}\:{dont}\:{know}\:{the}\:{answer}. \\ $$$${infact},\:{I}\:{have}\:{no}\:{idea}\: \\ $$
Commented by mr W last updated on 09/Mar/23
$${i}\:{hope}\:{my}\:{solution}\:{below}\:{could}\:{have} \\ $$$${helped}\:{you}. \\ $$
Answered by mr W last updated on 09/Mar/23
$${axy} \\ $$$${xay} \\ $$$${xya} \\ $$$$\left[\mathrm{100}×\mathrm{9}×\mathrm{8}+\mathrm{10}×\mathrm{8}×\mathrm{8}+\mathrm{8}×\mathrm{8}\right]\left(\mathrm{1}+\mathrm{2}+\mathrm{3}+…+\mathrm{9}\right) \\ $$$$=\mathrm{355}\:\mathrm{680}\:\checkmark \\ $$
Commented by Nimnim111118 last updated on 08/Mar/23
$${Thank}\:{you}\:{so}\:{much}. \\ $$$${But}\:{still}\:{I}\:{dont}\:{get}\:{the}\:{idea}… \\ $$
Commented by Nimnim111118 last updated on 08/Mar/23
$${In}\:{my}\:{opinion}: \\ $$$${Required}:\:\bullet{sum}\:{of}\:{all}\:\mathrm{3}\:{digit} \\ $$$$\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\bullet{all}\:{number}\:{started}\:{by}\:{odd} \\ $$$$\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\bullet\:{no}\:{digit}\:{are}\:{repeated} \\ $$$${So},\:{our}\:{question}\:{is}\:{likeky}\:{to}\:{be}\:{added}\:{up} \\ $$$${the}\:{folowing} \\ $$$$\mathrm{102}+\mathrm{103}+\mathrm{104}+\mathrm{105}+\mathrm{106}+\mathrm{107}+\mathrm{108}+\mathrm{109} \\ $$$$+\mathrm{120}+\mathrm{123}+\mathrm{124}+\mathrm{125}+\mathrm{126}+\mathrm{127}+\mathrm{128}+\mathrm{129} \\ $$$$+\mathrm{130}+\mathrm{132}+\mathrm{134}+\mathrm{135}+\mathrm{136}+\mathrm{137}+\mathrm{138}+\mathrm{139} \\ $$$${and}\:{it}\:{will}\:{go}\:{up}\:{to} \\ $$$$\mathrm{980}+\mathrm{981}+\mathrm{982}+\mathrm{983}+\mathrm{984}+\mathrm{985}+\mathrm{986}+\mathrm{987} \\ $$$$ \\ $$
Commented by mr W last updated on 09/Mar/23
$${in}\:{this}\:{way}\:{you}\:{sum}\:{up}\:{all}\:{the}\:{valid} \\ $$$${numbers}. \\ $$$${but}\:{i}'{m}\:{too}\:{lazy}\:{to}\:{do}\:{this}\:{hard}\:{work}. \\ $$$${instead}\:{of}\:{this}\:{i}\:{sum}\:{up}\:{all}\:{the}\:{digits} \\ $$$${in}\:{the}\:{numbers}.\:{this}\:{is}\:{easier},\:{because} \\ $$$${we}\:{have}\:{many}\:{many}\:{numbers},\:{but}\: \\ $$$${only}\:\mathrm{9}\:{digits}. \\ $$
Commented by mr W last updated on 08/Mar/23
$${in}\:{my}\:{solution}\:{above}\:{i}\:{considered}\: \\ $$$${all}\:\mathrm{3}\:{digit}\:{numbers}\:{with}\:{different} \\ $$$${digits},\:{also}\:{numbers}\:{starting}\:{with}\:{an} \\ $$$${even}\:{digit},\:{like}\:\mathrm{235}.\:{if}\:{you}\:{mean}\:{only} \\ $$$${numbers}\:{starting}\:{with}\:{an}\:{odd}\:{digit}, \\ $$$${then}\:{i}\:{must}\:{modify}\:{my}\:{solution}. \\ $$
Answered by mr W last updated on 09/Mar/23
$${when}\:{we}\:{want}\:{to}\:{get}\:{the}\:{sum}\:{of}\:{some} \\ $$$${numbers},\:{e}.{g}.\:\mathrm{123}+\mathrm{456},\:{we}\:{can}\:{also}\:{get} \\ $$$${the}\:{result}\:{by}\:{summing}\:{up}\:{the}\:{values} \\ $$$${which}\:{the}\:{individual}\:{digits}\:{represent}. \\ $$$${in}\:{this}\:{example},\:{to}\:{get}\:\mathrm{123}+\mathrm{456},\:{we} \\ $$$${can}\:{proceed}\:{like}\:{this}: \\ $$$$\mathrm{100}×\left(\mathrm{1}+\mathrm{4}\right)+\mathrm{10}×\left(\mathrm{2}+\mathrm{5}\right)+\mathrm{1}×\left(\mathrm{3}+\mathrm{6}\right) \\ $$$$=\mathrm{500}+\mathrm{70}+\mathrm{9} \\ $$$$=\mathrm{579} \\ $$$${to}\:{sum}\:{up}\:{all}\:\mathrm{3}\:{digit}\:{numbers}\:{which} \\ $$$${start}\:{with}\:{an}\:{odd}\:{digit}\:{and}\:{consist} \\ $$$${of}\:\mathrm{3}\:{different}\:{digits},\:{we}\:{can}\:{use}\:{this} \\ $$$${method}. \\ $$$${to}\:{get}\:{the}\:{sum}\:{of}\:{all}\:{values}\:{which} \\ $$$${the}\:{digit}\:“{a}“\:{represents}\:{in}\:{all} \\ $$$${such}\:\mathrm{3}\:{digit}\:{numbers}: \\ $$$$\underline{{type}\:{axy}:}\: \\ $$$${a}=\mathrm{1},\mathrm{3},\mathrm{5},\mathrm{7},\mathrm{9} \\ $$$${for}\:{each}\:“{a}''\:{there}\:{are}\:\mathrm{9}×\mathrm{8}\:{numbers}, \\ $$$$\mathrm{100}×\mathrm{9}×\mathrm{8}×\left(\mathrm{1}+\mathrm{3}+\mathrm{5}+\mathrm{7}+\mathrm{9}\right)=\mathrm{180}\:\mathrm{000} \\ $$$$\underline{{type}\:{xay}:} \\ $$$${a}=\mathrm{1},\mathrm{3},\mathrm{5},\mathrm{7},\mathrm{9}\:{or}\:\mathrm{2},\mathrm{4},\mathrm{6},\mathrm{8} \\ $$$${x}=\mathrm{1},\mathrm{3},\mathrm{5},\mathrm{7},\mathrm{9} \\ $$$$\mathrm{10}×\mathrm{4}×\mathrm{8}×\left(\mathrm{1}+\mathrm{3}+\mathrm{5}+\mathrm{7}+\mathrm{9}\right) \\ $$$$+\mathrm{10}×\mathrm{5}×\mathrm{8}×\left(\mathrm{2}+\mathrm{4}+\mathrm{6}+\mathrm{8}\right)=\mathrm{16}\:\mathrm{000} \\ $$$$\underline{{type}\:{xya}:} \\ $$$${similarly}\:{to}\:{type}\:{xay}. \\ $$$$\mathrm{1}×\mathrm{4}×\mathrm{8}×\left(\mathrm{1}+\mathrm{3}+\mathrm{5}+\mathrm{7}+\mathrm{9}\right) \\ $$$$+\mathrm{1}×\mathrm{5}×\mathrm{8}×\left(\mathrm{2}+\mathrm{4}+\mathrm{6}+\mathrm{8}\right)=\mathrm{1}\:\mathrm{600} \\ $$$$\boldsymbol{{all}}\:\boldsymbol{{together}}: \\ $$$$\mathrm{180}\:\mathrm{000}+\mathrm{16}\:\mathrm{000}+\mathrm{1}\:\mathrm{600}=\mathrm{197}\:\mathrm{600}\checkmark \\ $$$$ \\ $$$${that}\:{means}\:{there}\:{are}\:{totally}\: \\ $$$$\mathrm{5}×\mathrm{9}×\mathrm{8}=\mathrm{360}\:{such}\:{numbers},\:{and}\:{the}\: \\ $$$${sum}\:{of}\:{them}\:{is}\:\mathrm{197}\:\mathrm{600}. \\ $$
Commented by mr W last updated on 08/Mar/23
$${maybe}\:{Brandon}\:{sir}\:{can}\:{check}\:{this} \\ $$$${result}\:{with}\:{a}\:{program}. \\ $$
Commented by ARUNG_Brandon_MBU last updated on 09/Mar/23
Commented by ARUNG_Brandon_MBU last updated on 09/Mar/23
#include <iostream>
using namespace std;
int main(void)
{
short count=0;
int sum=0;
for (short i0, i1, i2, i=102; i<1000; i++)
{
i0 = i / 100;
i1 = i % 100 / 10;
i2 = i % 10;
if (i0%2==1&&i0!=i1&&i0!=i2&&i1!=i2)
{
sum += i;
count++;
}
}
cout << "There are " << count << "numbers";
cout << "\n their sum is " << sum;
return 0;
}
Commented by ARUNG_Brandon_MBU last updated on 09/Mar/23
Commented by mr W last updated on 09/Mar/23
$${great}\:{programing}!\:{thanks}\:{alot}\:{sir}! \\ $$
Commented by ARUNG_Brandon_MBU last updated on 09/Mar/23
You're welcome, Sir