Problem. sailors gather a pile of coconuts. During the night each sailor in turn divides the pile into equal parts with one left over (given to the monkey), hides one part, and puts the rest back. In the morning the remaining pile again divides into parts with one left over. Smallest initial pile?

Answer: ; for 5 sailors, .

long long coconuts(long long n) {                  // smallest pile: n sailors, each night one to the monkey then 1/n taken; morning split also leaves 1
    long long p = 1; for (int i = 0; i <= n; i++) p *= n;
    return p - n + 1;
}