the PRIME minister: Part 1

The prime minister decides to throw a party. He invites 796 people to his party. He and 796 people sat in a straight line seat from most commoner till royalty till the end of the seat; himself. He serves out plates containing nougats that count primely. The first person gets 2 nougats, the second gets 3, and so on until the prime minister himself gets the most, how many nougats did the prime minister receive?

6101 6133 6121 6113

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Hasmik Garyaka
Sep 10, 2017

The 797th prime number int i = 0, x = 2; long s = 2; for (i = 3; x <= 797; i += 2)

            if (checkPrime(i))
            {
                s += i;
                x++;

            }

        Console.WriteLine(i);

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...