
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
The pirate law states that, to divide the coins of a treasure, the captain must choose a group of pirates (excluding himself). Then, the captain must distribute the same amount of coins to each pirate in that group such that it is not possible to give any remaining coins to each pirate in the group (respecting that each pirate receives the same amount). The remaining coins are then given to the captain. On Captain Barbaroxa's ship, there are 100 pirates (not including the captain). Barbaroxa must divide a treasure that contains fewer than 1000 coins. If he chooses 99 pirates, he will have 51 coins left, but if he chooses 77 pirates, he will have 29 coins left.

a) How many coins does the treasure contain?

b) How many pirates should Barbaroxa choose to get the largest possible amount of coins?

Present the answer in LaTex format: \boxed{Your answer}
user