Skip to main content

1 reply

10-Marble
April 23, 2012

Agree and then there is a most important version of "for" that is missing. The notation of piecewise function! This is a single (or plural) line "for" where for is ";" We had it almost in Mathcad - had to use "for" and doublicate a single line.

24-Ruby IV
April 27, 2012

It will be good - if we not insert in the placeholder of the while cycle something - it will be an invisible 1.

Compare please two programs:

Fisermans-Fishers.png

Fish2.png

We need to have infinity cycle with one or more exits. An exit in the top of this cycles - we have a while cycle, an exit in the below of this cycle - we have a repeat cycle etc

PS

The task

Three fishermen lay down to sleep, not having counted or divided their catch. In the night, one of them woke up, and (not quite trusting the others) decided to divide the pile of fish and take his share. But the number of fish wasn't visible by three. However, he found he could throw one fish away, then take exactly a third. This he did (noting, in the true spirit of fairness, that an even number of fish was left for his comrades) and went back to sleep. Later, the second and third fishermen woke in turn, and each went through the same process. The question is, what is the MINIMUM number of fish in the catch that fulfils these conditions?