Okay here goes my try at doraki's riddle:
the captain gets 993 gold coins for himself. He distributes the coins as follows --
#9 (second in command) gets no coins, #8 gets 1, #7 gets 2, #6 gets 0, #5 gets 1, #4 gets 2, #3 gets 0, #2 gets 0, and #1 gets 1. Everyone who got any coin voted in favor of the captain's plan and all others voted against it.
The rationale: Imagine there were only four pirates. In that case, the leader would get all 1000 coins with the support of #2 and #3 who vote in his favor to avoid being killed in the subsequent votes (they cannot possibly achieve a majority since #4 will vote against them.) Because of this we know that if there were five pirates, the proposer could win a majority by giving 0 coins to his next in command, and 1 each to the remaining three thus gaining their votes by giving them each one more coin than they would get were they to vote against. The sequence of alternatives is as follows
(rank of pirate, higher number = higher rank)->(how many coins they get)(how they voted, y=yes, n=no)
1 pirate:
pirate gets teh moneys.
Hence in the case of 2 pirates:
any proposal fails since the other pirate will vote no, kill the proposer and keep the money, satisfying both bloodlust and greed
hence 3 pirates:
any proposal fails since 1 will vote no. Pirate 3 is killed.
hence 4 pirates:
4<-1000... 3->0y, 2->0y, 1->0n
hence 5 pirates:
5<-997... 4->0n, 3->1y, 2->1y, 1->1y
hence 6 pirates:
6<-995... 5->0n, 4->1y, 3->2y, 2->2y, 1->0n
hence 7 pirates:
7<-993... 6->0n, 5->1y, 4->2y, 3->3y, 2->0n, 1->1y
hence 8 pirates:
8<-994... 7->0n, 6->1y, 5->2y, 4->0n, 3->0n, 2->1y, 1->2y
hence 9 pirates:
9<-993... 8->0n, 7->1y, 6->2y, 5->0n, 4->1y, 3->1y, 2->2y, 1->0n
hence 10 pirates:
10<-993... 9->0n, 8->1y, 7->2y, 6->0n, 5->1y, 4->2y, 3->0n, 2->0n, 1->1y
let me know if my logic is off or if you don't follow my reasoning.