Sailors, coconuts and a monkey problem: Difference between revisions

m
→‎{{header|R}}: Syntax highlighting.
(Added R.)
m (→‎{{header|R}}: Syntax highlighting.)
Line 1,855:
=={{header|R}}==
The only tricky bit is reading comprehension. For example, it's easy to miss that the coconut count after the final nighttime visit must be strictly positive and divisible by the number of sailors.
<lang rrsplus>coconutsProblem <- function(sailorCount)
{
stopifnot(sailorCount > 1) #Problem makes no sense otherwise
Line 1,881:
6 7 823537
7 8 117440505</pre>
 
=={{header|Racket}}==
{{trans|Python}}
331

edits