+0  
 
0
345
1
avatar

A man has seven wives. He is on a business trip and earned good fortune. He sent some gold coins to his wives through a messenger and guided the messenger to give the coins in the presence of at least two wives and tell them to divide the gold coins equally among the seven wives. The messenger gave the coins to the eldest wife in the presence of second wife and left. The two of them decided to divide the coins between them. But in the process one coin is left

 

Both wanted the extra coin and started to quarrel. Hearing the noise the third came to know about the gold coins and now they decided to divide the coin among three of them. But again one coin is left. Again the three of them started to quarrel for the extra coin and the fourth wife came to know. Again the same thing happened when they decides to divide the coin among four of them one coin is left.

 

This continued till the seventh wife came to know and when they divided among seven of them it was equally divided and no coin was left. So what is the minimum number of coins that the husband sent?

 Jul 3, 2020
 #1
avatar
0

N mod 2 = 1

N mod 3 = 1

N mod 4 = 1

N mod 5 = 1

N mod 6 = 1

N mod 7 =0

 

i=0;j=0;m=0;t=0;a=( 2, 3, 4, 5, 6, 7);r= (1, 1, 1, 1, 1, 0);c=lcm(a); d=c / a[i];n=d % a[i] ;loop1:m++; if(n*m % a[i] ==1, goto loop, goto loop1);loop:s=(c/a[i]*r[j]*m);i++;j++;t=t+s;m=0;if(i< count a, goto4,m=m);printc,"m + ",t % c;return

 

420m + 301, where m=0, 1, 2, 3......etc.

The minimum number of gold coins the husband sent was 301 coins.

 Jul 3, 2020

3 Online Users

avatar
avatar