A General And His Soldiers

In ancient China, generals counted soldiers remaining after a battle by lining them up in rows of different lengths.

If a general had 1200 1200 soldiers at the start of a battle and if there were

1 ) 1) 3 3 left over when they lined up 5 5 at a time;

2 ) 2) 3 3 left over when they lined up 6 6 at a time;

3 ) 3) 1 1 left over when they lined up 7 7 at a time;

4 ) 4) none left over when they lined 11 11 at a time,

how many soldiers survived the battle?


The answer is 1023.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Arpit MIshra
Apr 18, 2015

Answer- 1023 \boxed{1023}

1
2
3
4
5
6
int x; //Intializing x
        for(x=1200;x>=1;x--) //counting backwards
        {
            if(x%5==3&&x%6==3&&x%7==1&&x%11==0) //Eg: 3 left when lined up in 5's is comparable to modulous
            System.out.println(x);
        }

Output- 1023

Julian Poon
Aug 16, 2014

I solved this with pattern recognition. I am sure there is a more elegant way to solve this than my method.

there's nothing really more elegant than repeated applications of CRT.

mathh mathh - 6 years, 10 months ago

Log in to reply

yup! CRT is very easy

Mohamed Moanis - 6 years, 9 months ago

Log in to reply

Actually... I don't understand CRT. All the number theory questions that I solved and requires CRT I solve with a more inelegant way called algebra.

Julian Poon - 6 years, 8 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...