5 Sailors and a monkey landed on an island in the southern Pacific Ocean. They found a big pile of coconuts. Since they were so tired and it was getting late, they all went to sleep instead.
Allan woke up at night. He wanted to get his share right then. He divided the coconuts evenly into 5 piles, but one coconut was left. He hid one pile for himself and gave the extra one to the monkey. He went back to sleep.
Brad woke up (without knowing what had happened) after Allan. He divided the rest of the coconuts evenly into 5 piles, but one coconut was left. He hid one pile for himself and gave the extra one to the monkey. He went back to sleep.
Charlie woke up (without knowing what had happened) after Brad. He divided the rest of the coconuts evenly into 5 piles, but one coconut was left. He hid one pile for himself and gave the extra one to the monkey. He went back to sleep.
David woke up (without knowing what had happened) after Charlie. He divided the rest of the coconuts evenly into 5 piles, but one coconut was left. He hid one pile for himself and gave the extra one to the monkey. He went back to sleep.
Earl woke up (without knowing what had happened) after David. He divided the rest of the coconuts evenly into 5 piles, but one coconut was left. He hid one pile for himself and gave the extra one to the monkey. He went back to sleep.
When they all awoke in the morning, they determined to divide the rest of the coconuts evenly into 5 piles. Each sailor got a pile. Again one coconut was left, and they gave it to the monkey. Everybody got one pile. How many coconuts did each person get?
Allan woke up at night. He wanted to get his share right then. He divided the coconuts evenly into 5 piles, but one coconut was left. He hid one pile for himself and gave the extra one to the monkey. He went back to sleep.
Brad woke up (without knowing what had happened) after Allan. He divided the rest of the coconuts evenly into 5 piles, but one coconut was left. He hid one pile for himself and gave the extra one to the monkey. He went back to sleep.
Charlie woke up (without knowing what had happened) after Brad. He divided the rest of the coconuts evenly into 5 piles, but one coconut was left. He hid one pile for himself and gave the extra one to the monkey. He went back to sleep.
David woke up (without knowing what had happened) after Charlie. He divided the rest of the coconuts evenly into 5 piles, but one coconut was left. He hid one pile for himself and gave the extra one to the monkey. He went back to sleep.
Earl woke up (without knowing what had happened) after David. He divided the rest of the coconuts evenly into 5 piles, but one coconut was left. He hid one pile for himself and gave the extra one to the monkey. He went back to sleep.
When they all awoke in the morning, they determined to divide the rest of the coconuts evenly into 5 piles. Each sailor got a pile. Again one coconut was left, and they gave it to the monkey. Everybody got one pile. How many coconuts did each person get?
Answer : Initially there were 15621 coconuts. Now you can derive what ever answer you desire to find. And I calculated above number using Fortran program which goes as below
ReplyDeleteProgram PZ2
implicit none
integer ::i,j,flag=0
REAL*8 :: n=10,n1=1,n2=1,n3=1,n4=1,n5=1,ni6=1
Real*8 :: n6,k=5
do
if (mod((n-1),k)==0) then
n1 = (n-1)/5
if (mod(((4*n1)-1),k)==0) then
n2 = ((4*n1)-1)/5
if (mod(((4*n2)-1),k)==0) then
n3= ((4*n2)-1)/5
if(mod(((4*n3)-1),k)==0)then
n4=((4*n3)-1)/5
if(mod(((4*n4)-1),k)==0)then
n5=((4*n4)-1)/5 !All Fraud Done
if(mod(((4*n5)-1),k)==0)then
n6=((4*n5)-1)/5 !All Shearing Done
ni6=n6
if((n6-ni6)==0) then
print*,"Number of coconuts are ",n
flag=1
endif
endif
endif
endif
endif
endif
endif
n=n+1
if(flag==1) exit
enddo
endprogram PZ2