/riddlesAtWork

Riddles at work.

Primary LanguageJavaScriptMIT LicenseMIT

riddlesAtWork

Purpose: Solves the following riddle

Riddle 1:

There is a house with N number of functional lights turned off. If person i enters the house they will toggle the lights that are a multiple of i. How many lights are on if 100 people enter the house?

Solution

Riddle 2:

There are three piles of apples.

  • Pile A contains 3 apples
  • Pile B contains 5 apples
  • Pile C contains 7 apples

You're placed against an opponent to pick up apples. The objective of the game is to have your opponent take the last apple on their turn. Each person has to take turns picking up apples from only one pile at a time. On a player's turn, they can pick up any positive value of the remaining apples in one pile.

What's the best strategy to win the most games?

Riddle 3:

From: https://puzzling.stackexchange.com/questions/43923/we-are-5-different-numbers

There 5 different positive integer numbers smaller than 100. The product of us is an odd number. The product of us is a cube number. The sum of us is a cube number.

Riddle 4:

If you roll two fair six-sided dice, what is the probability that the sum is 9 or higher? Simulate the environment to compute it the value.